Markdown processing library for VuePress with enhanced plugins for documentation sites
—
Comprehensive documentation of all built-in plugins included with @vuepress/markdown, their functionality, and configuration options.
These plugins are essential for VuePress functionality and cannot be removed.
Enables Vue components within markdown content, supporting both PascalCase components and custom elements with hyphens.
// Plugin name constant
PLUGINS.COMPONENT: 'component'Functionality:
<MyComponent />)<custom-element />)Usage Examples:
<!-- Vue components in markdown -->
<MyButton type="primary">Click me</MyButton>
<CustomCard title="Hello">
This content will be rendered inside the card component.
</CustomCard>
<!-- Custom elements -->
<my-widget data="example"></my-widget>Generates heading anchors with permalinks for navigation and deep linking.
// Plugin name constant
PLUGINS.ANCHOR: 'anchor'Default Configuration:
{
slugify: slugifyFunction,
permalink: true,
permalinkBefore: true,
permalinkSymbol: '#'
}Functionality:
These plugins provide additional functionality and can be removed if not needed.
Highlights specific lines within code blocks using line number ranges.
PLUGINS.HIGHLIGHT_LINES: 'highlight-lines'Usage Examples:
<!-- Highlight lines 1 and 3-5 -->
\`\`\`js{1,3-5}
console.log('line 1'); // highlighted
console.log('line 2');
console.log('line 3'); // highlighted
console.log('line 4'); // highlighted
console.log('line 5'); // highlighted
\`\`\`
<!-- Highlight single line -->
\`\`\`python{2}
def hello():
print("This line is highlighted")
return True
\`\`\`Wraps code blocks with additional container elements for enhanced styling and functionality.
PLUGINS.PRE_WRAPPER: 'pre-wrapper'Functionality:
Adds line numbers to code blocks for better readability and reference.
PLUGINS.LINE_NUMBERS: 'line-numbers'Configuration:
const md = createMarkdown({
lineNumbers: true // Enable line numbers globally
});Usage Examples:
<!-- Code block with line numbers -->
\`\`\`javascript
function calculateSum(a, b) {
return a + b;
}
const result = calculateSum(5, 3);
console.log(result);
\`\`\`Includes code snippets from external files with optional line highlighting and language specification.
PLUGINS.SNIPPET: 'snippet'Usage Examples:
<!-- Include entire file -->
<<< @/path/to/file.js
<!-- Include with language specification -->
<<< @/path/to/file.py{python}
<!-- Include with line highlighting -->
<<< @/path/to/file.js{1,3-5}
<!-- Include with both language and highlighting -->
<<< @/path/to/component.vue{vue}{1-10,15}Converts markdown links to Vue Router links for internal navigation and handles external links.
PLUGINS.CONVERT_ROUTER_LINK: 'convert-router-link'Default Configuration:
{
target: '_blank',
rel: 'noopener noreferrer'
}Functionality:
Hoists <script> and <style> tags from markdown content to the document head for proper execution.
PLUGINS.HOIST_SCRIPT_STYLE: 'hoist-script-style'Usage Examples:
<!-- These will be hoisted to document head -->
<script>
export default {
mounted() {
console.log('Component mounted');
}
}
</script>
<style scoped>
.my-component {
color: blue;
}
</style>
# My Component
Regular markdown content here.These plugins are included via external packages.
Converts emoji shortcodes to Unicode emoji characters.
PLUGINS.EMOJI: 'emoji'Usage Examples:
I love VuePress :heart:!
This plugin is :fire: :rocket:!
Good job :+1: :thumbsup:Renders as:
I love VuePress ❤️!
This plugin is 🔥 🚀!
Good job 👍 👍Generates table of contents from markdown headings.
PLUGINS.TOC: 'toc'Default Configuration:
{
slugify: slugifyFunction,
includeLevel: [2, 3],
format: parseHeaders
}Usage Examples:
<!-- Generate TOC for headings level 2-3 -->
[[toc]]
## Section 1
### Subsection 1.1
### Subsection 1.2
## Section 2
### Subsection 2.1All code blocks benefit from built-in syntax highlighting powered by Prism.js.
Supported Languages:
Language Detection:
Features:
Install with Tessl CLI
npx tessl i tessl/npm-vuepress--markdown