本页还没有译文
本页 60 段还没译成Tiếng Việt,下面显示的是英文原文。Extensions
还没翻译译自英文(tanstack.com)本页 60 段都还没译
Extensions
Every built-in extension is available through a separate package entry.
Callouts
Import from @tanstack/markdown/extensions/callouts.
calloutsExtension
function calloutsExtension(): MarkdownExtensionCreates the block parser for GitHub-style > [!KIND] Optional title callouts.
parseCalloutBlock
function parseCalloutBlock(
context: BlockParseContext,
): CalloutNode | undefinedLow-level parser used by calloutsExtension.
Comment components
Import from @tanstack/markdown/extensions/comment-components.
CommentComponentOptions
Provides an optional transformComponent(node) callback that receives each parsed ComponentNode.
ComponentComment
Parsed comment data with block, lowercase name, and string attributes.
commentComponentsExtension
function commentComponentsExtension(
options?: CommentComponentOptions,
): MarkdownExtensionParses single <!-- ::name --> comments and paired <!-- ::start:name --> / <!-- ::end:name --> blocks.
parseCommentComponentBlock
Parses a component at the current block context and optionally transforms it.
parseComponentComment
function parseComponentComment(
line: string,
): ComponentComment | undefinedParses one component start or single-component comment.
parseAttributes
function parseAttributes(value: string): Record<string, string>Parses quoted, unquoted, and boolean-style attributes. A valueless attribute becomes the string "true".
Docs preset
Import from @tanstack/markdown/extensions/docs.
DocsMarkdownOptions
Contains collectHeadings?: boolean | HeadingCollectionOptions.
docsMarkdownExtensions
function docsMarkdownExtensions(
options?: DocsMarkdownOptions,
): MarkdownExtension[]Returns callouts, transformed comment components, and heading collection unless collection is disabled.
transformDocsComponent
Routes tabs and framework component nodes to their built-in transforms and returns other nodes unchanged.
Framework transform
Import from @tanstack/markdown/extensions/framework.
transformFrameworkComponent
function transformFrameworkComponent(
node: ComponentNode,
): ComponentNodeSplits level-one framework sections into md-framework-panel children, records available-framework and code-block metadata, and labels nested headings by framework.
Heading collection
Import from @tanstack/markdown/extensions/headings.
HeadingCollectionOptions
Contains skipComponentNames?: ReadonlySet<string> | string[]. The default skips headings inside tabs components.
headingCollectionExtension
function headingCollectionExtension(
options?: HeadingCollectionOptions,
): MarkdownExtensionCreates a document transform that writes collected headings to document.headings.
collectMarkdownHeadings
function collectMarkdownHeadings(
document: MarkdownDocument,
options?: HeadingCollectionOptions,
): MarkdownHeading[]Collects headings recursively through lists, blockquotes, callouts, and components while respecting skipped component names and framework labels.
Streaming
Import from @tanstack/markdown/extensions/streaming.
streamingMarkdownExtension
function streamingMarkdownExtension(): MarkdownExtensionCreates a document transform for accumulated AI responses. The transform removes an empty trailing heading, blockquote, or list item that is likely to be an incomplete block marker. All completed content keeps the core parser's normal output.
Tab transforms
Import from @tanstack/markdown/extensions/tabs.
transformTabsComponent
Dispatches by the component’s variant attribute. Unknown or missing variants use heading-based tabs.
transformFileTabs
Turns code-block children into md-tab-panel elements and records file names, languages, and code in data properties.
transformPackageManagerTabs
Parses shared package... lines and framework: package... lines and records package groups plus install, dev-install, or local-install mode. A framework prefix is a name of letters, digits, _, or - followed by a colon that is not directly followed by / or ., so URL and path specifiers such as https:// and file:../ stay shared. Each line becomes a separate command group. Unprefixed groups appear under the empty string key in packagesByFramework and are also included in each named framework's groups, preserving source order.
transformBundlerTabs
Selects Vite and Rsbuild heading sections and converts them to panels.
transformHeadingTabs
Splits content at the shallowest heading depth, creates stable tab slugs, and emits one panel per section.
The transforms return the original node when their expected input structure is absent.