-
Notifications
You must be signed in to change notification settings - Fork 35
New tko io site #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
New tko io site #227
Changes from all commits
7489984
dca6189
70c3a32
a4ac0cb
4f00b05
59f5e53
25d9bf0
e75196f
7174360
41745d7
67e2d98
d7e4b57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Deploy Documentation | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
|
|
||
| - name: Install dependencies | ||
| run: cd tko.io && bun install | ||
|
|
||
| - name: Build site | ||
| run: cd tko.io && bun run build | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: tko.io/_site | ||
|
|
||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,3 +29,4 @@ coverage/ | |
| .vscode/extensions.json | ||
| !.vscode/launch.json | ||
| .vscode/settings.json | ||
| .playwright-mcp | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import markdownIt from "markdown-it"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Port to TypeScript at some point?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ideally yes, good point, but I'm not sure how / whether eleventy can import it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not necessary: https://www.11ty.dev/docs/languages/typescript/ |
||
|
|
||
| export default function(eleventyConfig) { | ||
| // Follow symlinks | ||
| eleventyConfig.setServerOptions({ | ||
| followSymlinks: true | ||
| }); | ||
|
|
||
| // Copy static assets | ||
| eleventyConfig.addPassthroughCopy("src/css"); | ||
| eleventyConfig.addPassthroughCopy("src/js"); | ||
| eleventyConfig.addPassthroughCopy("src/lib"); | ||
| eleventyConfig.addPassthroughCopy("src/CNAME"); | ||
|
|
||
| // Watch for changes | ||
| eleventyConfig.addWatchTarget("src/css/"); | ||
| eleventyConfig.addWatchTarget("src/js/"); | ||
|
|
||
| // Configure markdown | ||
| const md = markdownIt({ | ||
| html: true, | ||
| breaks: false, | ||
| linkify: true | ||
| }); | ||
|
|
||
| eleventyConfig.setLibrary("md", md); | ||
|
|
||
| // Create collections for each documentation category | ||
| eleventyConfig.addCollection("bindingDocs", function(collectionApi) { | ||
| return collectionApi.getFilteredByGlob("src/docs/bindings/*.md") | ||
| .filter(page => !page.url.endsWith('/bindings/')) | ||
| .sort((a, b) => a.fileSlug.localeCompare(b.fileSlug)); | ||
| }); | ||
|
|
||
| eleventyConfig.addCollection("observableDocs", function(collectionApi) { | ||
| return collectionApi.getFilteredByGlob("src/docs/observables/*.md") | ||
| .filter(page => !page.url.endsWith('/observables/')) | ||
| .sort((a, b) => a.fileSlug.localeCompare(b.fileSlug)); | ||
| }); | ||
|
|
||
| eleventyConfig.addCollection("computedDocs", function(collectionApi) { | ||
| return collectionApi.getFilteredByGlob("src/docs/computed/*.md") | ||
| .filter(page => !page.url.endsWith('/computed/')) | ||
| .sort((a, b) => a.fileSlug.localeCompare(b.fileSlug)); | ||
| }); | ||
|
|
||
| eleventyConfig.addCollection("componentDocs", function(collectionApi) { | ||
| return collectionApi.getFilteredByGlob("src/docs/components/*.md") | ||
| .filter(page => !page.url.endsWith('/components/')) | ||
| .sort((a, b) => a.fileSlug.localeCompare(b.fileSlug)); | ||
| }); | ||
|
|
||
| eleventyConfig.addCollection("bindingContextDocs", function(collectionApi) { | ||
| return collectionApi.getFilteredByGlob("src/docs/binding-context/*.md") | ||
| .filter(page => !page.url.endsWith('/binding-context/')) | ||
| .sort((a, b) => a.fileSlug.localeCompare(b.fileSlug)); | ||
| }); | ||
|
|
||
| eleventyConfig.addCollection("advancedDocs", function(collectionApi) { | ||
| return collectionApi.getFilteredByGlob("src/docs/advanced/*.md") | ||
| .filter(page => !page.url.endsWith('/advanced/')) | ||
| .sort((a, b) => a.fileSlug.localeCompare(b.fileSlug)); | ||
| }); | ||
|
|
||
| // Add filter to format titles from file slugs | ||
| eleventyConfig.addFilter("formatTitle", function(slug) { | ||
| return slug | ||
| .split('-') | ||
| .map(word => word.charAt(0).toUpperCase() + word.slice(1)) | ||
| .join(' '); | ||
| }); | ||
|
|
||
| // Add filter to format binding names (keeps lowercase, removes -binding suffix) | ||
| eleventyConfig.addFilter("formatBindingName", function(slug) { | ||
| return slug.replace(/-binding$/, ''); | ||
| }); | ||
|
|
||
| return { | ||
| dir: { | ||
| input: "src", | ||
| output: "_site", | ||
| includes: "_includes", | ||
| layouts: "_layouts" | ||
| }, | ||
| markdownTemplateEngine: "njk", | ||
| htmlTemplateEngine: "njk" | ||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| build | ||
| node_modules/ | ||
| _site/ | ||
| package-lock.json | ||
| src/lib/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # TKO Documentation Site | ||
|
|
||
| This is the documentation website for TKO, built with 11ty (Eleventy). | ||
|
|
||
| ## Development | ||
|
|
||
| ```bash | ||
| # Install dependencies | ||
| bun install | ||
|
|
||
| # Start local development server | ||
| bun run dev | ||
|
|
||
| # Build for production | ||
| bun run build | ||
| ``` | ||
|
|
||
| The site will be available at http://localhost:8080/ | ||
|
|
||
| ## Features | ||
|
|
||
| - Written in Markdown | ||
| - Interactive JSX examples using esbuild-wasm | ||
| - Examples are written in code blocks and automatically transformed into editable textareas with live preview | ||
| - Styled with the classic TKO theme | ||
|
|
||
| ## Structure | ||
|
|
||
| ``` | ||
| tko.io/ | ||
| ├── src/ | ||
| │ ├── _layouts/ # Page layouts (Nunjucks) | ||
| │ ├── _includes/ # Reusable components | ||
| │ ├── css/ # Stylesheets | ||
| │ ├── js/ # JavaScript (example system) | ||
| │ ├── docs/ # Documentation pages (Markdown) | ||
| │ └── index.md # Homepage | ||
| ├── _site/ # Built site (gitignored) | ||
| └── .eleventy.js # 11ty configuration | ||
| ``` | ||
|
|
||
| ## Adding Documentation | ||
|
|
||
| 1. Create a new `.md` file in `src/docs/` | ||
| 2. Add front matter with layout and title: | ||
| ```yaml | ||
| --- | ||
| layout: base.njk | ||
| title: Your Page Title | ||
| --- | ||
| ``` | ||
| 3. Write content in Markdown | ||
| 4. Add interactive JSX examples using: | ||
| ````markdown | ||
| ```jsx | ||
| function Example() { | ||
| return <div>Hello World</div> | ||
| } | ||
| ``` | ||
| ```` | ||
|
|
||
| ## Deployment | ||
|
|
||
| The site is automatically deployed to GitHub Pages when changes are pushed to the `main` branch. |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The render function parameter uses 'any' type, which bypasses TypeScript's type checking. Consider defining a proper JSX type or using a more specific type to improve type safety and API clarity.