Warning
This is an internal project, and is not intended for public use. No support or stability guarantees are provided.
A remark plugin that automatically cleans up meta links ("[See Demo]", "[See Setup]", "[See Types]") and horizontal rules that follow Demo and Types components in markdown documentation. This plugin identifies these components (without .Title) and removes associated navigation elements to create cleaner documentation.
Use this plugin to automatically clean up meta link patterns in your documentation. It removes redundant links that point to demo, setup, or type pages and optional horizontal rules that follow Demo and Types components, streamlining the reading experience by eliminating unnecessary navigation clutter.
<Demo and <Types components without .Title props---) that follow matched componentsimport { unified } from 'unified';
import remarkParse from 'remark-parse';
import transformMarkdownMetaLinks from '@mui/internal-docs-infra/pipeline/transformMarkdownMetaLinks';
const processor = unified().use(remarkParse).use(transformMarkdownMetaLinks);
This plugin is automatically included when using withDocsInfra() from @mui/internal-docs-infra. See the CodeHighlighter documentation for examples of Demo components in action.
The most common usage - removes "[See Demo]" links and horizontal rules that follow Demo components:
Before:
<Demo src="ButtonDemo" />
[See Demo](/material-ui/react-button/)
---
More content here...
After:
<Demo src="ButtonDemo" />
More content here...
Before:
<Demo
src="advanced/ButtonDemo"
variant="playground"
height={400}
/>
[See Demo](/material-ui/react-button/playground/)
---
Next section content...
After:
<Demo
src="advanced/ButtonDemo"
variant="playground"
height={400}
/>
Next section content...
Removes horizontal rules even when there's no meta link:
Before:
<Demo src="SimpleDemo" />
---
Continue reading...
After:
<Demo src="SimpleDemo" />
Continue reading...
Also works with Types components and "[See Types]" links:
Before:
<TypesButton />
[See Types](./types.md#button)
---
More content here...
After:
<TypesButton />
More content here...
Handles "[See Setup]" links that follow Demo components:
Before:
<DemoPerformance />
[See Setup](./demos/code/)
More content here...
After:
<DemoPerformance />
More content here...
The plugin detects Demo and Types components in various formats:
Standalone HTML:
<Demo src="ButtonDemo" />
Opening/Closing Tags:
<Demo src="ButtonDemo">
Content here
</Demo>
Multiline with Properties:
<Demo
src="advanced/ButtonDemo"
variant="playground"
height={400}
/>
Demo components with .Title are not processed:
Preserved (not cleaned up):
<Demo.Title>Button Examples</Demo.Title>
[See Demo](/material-ui/react-button/)
---
This pattern remains unchanged because Demo.Title components serve a different purpose and their associated links should be preserved.
Meta Links:
Horizontal Rules:
---)The plugin preserves:
.TitleRemove redundant navigation elements from documentation that already contains interactive demos.
Clean up documentation when migrating from external demo pages to embedded demos.
Eliminate navigation clutter to create a more focused reading experience.
This plugin works out-of-the-box with no configuration required. It automatically detects Demo components and cleans up associated navigation elements.
For more information about Demo components and how they work with the CodeHighlighter system, see the CodeHighlighter documentation.
Problem: Meta links remain in the output.
Solutions:
.TitleProblem: The plugin doesn't recognize components.
Solutions:
.Title (which is excluded)Problem: Content is being removed that shouldn't be.
Solutions: