-
-
Notifications
You must be signed in to change notification settings - Fork 316
add redirects into frontmatter & update deps #797
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3d25b73
feat: add redirect_from field and normalizeRedirectFrom utility
LadyBluenotes 75da0b8
add frontmatter-driven redirects for docs and blog
LadyBluenotes 642c668
add redirect_from conflict validation
LadyBluenotes 558c517
add maintainer documentation for markdown features and redirects
LadyBluenotes 3fe7d59
tester
LadyBluenotes 708f666
ci: apply automated fixes
autofix-ci[bot] 2afc1ac
updated redirect logic
LadyBluenotes a43428a
update packages
LadyBluenotes 22afda6
update shiki
LadyBluenotes 4304756
ci: apply automated fixes
autofix-ci[bot] 05a5bd5
remove unused deps
LadyBluenotes 5ca75bd
oxlint
LadyBluenotes 9ef4714
fix pnpm lock
LadyBluenotes c6b1f0b
fix rules/build
LadyBluenotes 6e3c431
update node version
LadyBluenotes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,243 @@ | ||
| # Maintainer Documentation Guide | ||
|
|
||
| This page covers the markdown features supported in TanStack docs and the preferred workflow for future redirects. | ||
|
|
||
| ## Redirects | ||
|
|
||
| For new page moves or consolidations, keep the canonical page and list old URLs in frontmatter with `redirect_from`. | ||
|
|
||
| ```yaml | ||
| --- | ||
| title: Overview | ||
| redirect_from: | ||
| - /framework/react/overview | ||
| - /framework/solid/overview | ||
| --- | ||
| ``` | ||
|
|
||
| In the example above, old framework-specific URLs will redirect to the shared `/overview` page without needing to add a new entry to the central redirect files in the `tanstack.com` repo. | ||
|
|
||
| ## Supported markdown | ||
|
|
||
| Docs support normal GitHub-flavored markdown, including: | ||
|
|
||
| - headings | ||
| - links | ||
| - lists | ||
| - tables | ||
| - fenced code blocks | ||
| - images | ||
| - blockquotes | ||
| - task lists | ||
|
|
||
| ## Callouts | ||
|
|
||
| GitHub-style alerts are supported. For a customized title, for example to replace `Note` with something else, you can use the syntax `> [!TYPE] Title`: | ||
|
|
||
| ```md | ||
| > [!NOTE] Custom title | ||
| > Use `redirect_from` on the canonical page when docs are moved. | ||
|
|
||
| > [!TIP] | ||
| > Prefer absolute paths like `/framework/react/overview`. | ||
| ``` | ||
|
|
||
| ## Code Blocks | ||
|
|
||
| Fenced code blocks are supported with language identifiers for syntax highlighting. You can also add metadata like `title="..."` for file tabs. | ||
|
|
||
| ````md | ||
| ```tsx title="app.tsx" | ||
| export function App() { | ||
| return <div>Hello</div> | ||
| } | ||
| ;`` | ||
| ``` | ||
| ```` | ||
|
|
||
| ## Tabs component | ||
|
|
||
| The tabs component lets you group content into tabbed sections. It supports multiple variants, including file tabs and package manager tabs. | ||
|
|
||
| ### File tabs | ||
|
|
||
| Use `variant="files"` when the block should render code examples as file tabs. It scans consecutive code blocks, extracts language, title, and content, and uses that to build `file-tab` data. Titles come from code-block metadata such as `title="..."` or will default to the language name if not provided. | ||
|
|
||
| ````md | ||
| <!-- ::start:tabs variant="files" --> | ||
|
|
||
| ```tsx file="app.tsx" | ||
| export function App() { | ||
| return <div>Hello</div> | ||
| } | ||
| ``` | ||
|
|
||
| ```css file="styles.css" | ||
| body { | ||
| color: tomato; | ||
| } | ||
| ``` | ||
|
|
||
| <!-- ::end:tabs --> | ||
| ```` | ||
|
|
||
| ### What matters | ||
|
|
||
| - use fenced code blocks | ||
| - add `title="..."` if you want meaningful file tab labels | ||
| - language comes from the code fence language | ||
| - code text is extracted from the `<code>` node content | ||
|
|
||
| ### Package manager tabs | ||
|
|
||
| Package-manager tabs are a special `tabs` variant. The parser reads framework lines like `react: ...` or `solid: ...`, groups packages, and later generates package-manager-specific commands. | ||
|
|
||
| There are various supported package manager formats, including npm, yarn, pnpm, and bun. | ||
|
|
||
| If you're looking to support a multi-line command, you can add multiple instances of the same framework. For example: | ||
|
|
||
| ```md | ||
| <!-- ::start:tabs variant="package-manager" --> | ||
|
|
||
| react: <package-1> | ||
| react: <package-2> | ||
|
|
||
| <!-- ::end:tabs --> | ||
| ``` | ||
|
|
||
| This will become: | ||
|
|
||
| ```bash | ||
| npm i <package-1> | ||
| npm i <package-2> | ||
| ``` | ||
|
|
||
| #### Supported modes | ||
|
|
||
| - `install` (default) | ||
| - `dev-install` | ||
| - `local-install` | ||
| - `create` | ||
| - `custom` (for custom command templates) | ||
|
|
||
| ##### Install (default) | ||
|
|
||
| ```md | ||
| <!-- ::start:tabs variant="package-manager" mode="install" --> | ||
|
|
||
| react: <package> | ||
| solid: <package> | ||
|
|
||
| <!-- ::end:tabs --> | ||
| ``` | ||
|
|
||
| becomes | ||
|
|
||
| ```bash | ||
| npm i <package> | ||
| ``` | ||
|
|
||
| ##### Dev install | ||
|
|
||
| ```md | ||
| <!-- ::start:tabs variant="package-manager" mode="dev-install" --> | ||
|
|
||
| react: <package> | ||
| solid: <package> | ||
|
|
||
| <!-- ::end:tabs --> | ||
| ``` | ||
|
|
||
| becomes | ||
|
|
||
| ```bash | ||
| npm i -D <package> | ||
| ``` | ||
|
|
||
| ##### Local install | ||
|
|
||
| ```md | ||
| <!-- ::start:tabs variant="package-manager" mode="local-install" --> | ||
|
|
||
| react: <package> | ||
| solid: <package> | ||
|
|
||
| <!-- ::end:tabs --> | ||
| ``` | ||
|
|
||
| becomes | ||
|
|
||
| ```bash | ||
| npx <package> --workspace=./path/to/workspace | ||
| ``` | ||
|
|
||
| ##### Create | ||
|
|
||
| ```md | ||
| <!-- ::start:tabs variant="package-manager" mode="create" --> | ||
|
|
||
| react: <package> | ||
| solid: <package> | ||
|
|
||
| <!-- ::end:tabs --> | ||
| ``` | ||
|
|
||
| becomes | ||
|
|
||
| ```bash | ||
| npm create <package> | ||
| ``` | ||
|
|
||
| ##### Custom | ||
|
|
||
| ```md | ||
| <!-- ::start:tabs variant="package-manager" mode="custom" --> | ||
|
|
||
| react: <command> <package> | ||
| solid: <command> <package> | ||
|
|
||
| <!-- ::end:tabs --> | ||
| ``` | ||
|
|
||
| becomes | ||
|
|
||
| ```bash | ||
| npm <command> <package> | ||
| ``` | ||
|
|
||
| ## Framework component | ||
|
|
||
| Framework blocks let one markdown source contain React, Solid, or other framework-specific content. Internally, the transformer looks for h1 headings inside the framework block and treats each `# Heading` as a framework section boundary. It then stores framework metadata and rewrites the block into separate framework panels. | ||
|
|
||
| > **Note**: This should only be used when the majority of the content is the same. If the content is mostly different, it's better to create separate markdown files for each framework and use redirects to point to the canonical page. | ||
|
|
||
| ````md | ||
| <!-- ::start:framework --> | ||
|
|
||
| # React | ||
|
|
||
| Use the React adapter here. | ||
|
|
||
| ```tsx | ||
| // React code | ||
| ``` | ||
|
|
||
| # Solid | ||
|
|
||
| Use the Solid adapter here. | ||
|
|
||
| ```tsx | ||
| // Solid Code | ||
| ``` | ||
|
|
||
| <!-- ::end:framework --> | ||
| ```` | ||
|
|
||
| Each top-level `#` heading becomes a framework panel. Nested headings inside a framework section are preserved for the table of contents. | ||
|
|
||
| ## Editing notes | ||
|
|
||
| - Keep redirects on the surviving page, not on the page being removed. | ||
| - Use absolute paths in `redirect_from`. | ||
| - Avoid duplicate `redirect_from` values across pages. | ||
| - Existing central redirect files still handle older redirects; use frontmatter for new ones going forward. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.