UNPKG

@tanstack/markdown

Version:

A tiny, fast, deterministic Markdown renderer for blogs and documentation.

26 lines (25 loc) 979 B
import { calloutsExtension } from './callouts.js'; import { commentComponentsExtension } from './comment-components.js'; import { transformFrameworkComponent } from './framework.js'; import { headingCollectionExtension } from './headings.js'; import { transformTabsComponent } from './tabs.js'; export function docsMarkdownExtensions(options = {}) { const extensions = [ calloutsExtension(), commentComponentsExtension({ transformComponent: transformDocsComponent, }), ]; if (options.collectHeadings !== false) { extensions.push(headingCollectionExtension(typeof options.collectHeadings === 'object' ? options.collectHeadings : {})); } return extensions; } export function transformDocsComponent(node) { const name = node.name.toLowerCase(); if (name === 'tabs') return transformTabsComponent(node); if (name === 'framework') return transformFrameworkComponent(node); return node; }