Methods#
(inner) marpitPlugin(plugin) → {function}#
Create Marpit plugin.
Generate Marpit plugin from passed markdown-it plugin. Marpit plugin needs markdown-it instance with marpit
member.
Parameters:
Name | Type | Description |
---|---|---|
plugin | function | Base plugin for markdown-it. |
Returns:
Generated Marpit plugin.
- Type:
- function
Example
import { marpitPlugin } from '@marp-team/marpit/plugin' export default marpitPlugin((md) => { // Compatible with markdown-it plugin md.renderer.rules.your_rule = (tokens, idx, options, env, self) => { // ... } // And accessible to Marpit instance as `md.marpit` const { marpit } = md marpit.customDirectives.local.yourDirective = (value) => { return { yourDirective: value } } })