• English
  • Remark plugins

    Remark plugins run while Markdown is parsed into its syntax tree, MDAST. Use them to add a syntax extension or adapt an existing unified remark plugin.

    Declare a plugin

    For example, remark-cjk-friendly improves emphasis parsing around Chinese, Japanese, and Korean punctuation:

    pnpm add @fluxdown/core-plugins remark-cjk-friendly
    import { BaseRemarkPlugin } from '@fluxdown/core-plugins/plugins/remark/base';
    import remarkCjkFriendly from 'remark-cjk-friendly';
    
    class CjkSyntaxPlugin extends BaseRemarkPlugin {
      static readonly key = 'remark-cjk-syntax';
    
      readonly plugin = remarkCjkFriendly;
    }
    
    const remarks = [CjkSyntaxPlugin];

    key identifies the plugin. plugin is the unified plugin that registers the syntax extension. Core already supplies the Markdown parser.

    Use it

    Add remarks to the Core inputs from the quick start. Existing presets stay enabled.

    If your unified plugin needs options, accept them in the class constructor and create a plugin function that closes over those options. Pass them as [YourPlugin, options].

    remark extensions can also transform MDAST. Use repair when the change should follow Core's repair switches or target the streaming tail.

    Supported plugins

    Append a subpath from the table to @fluxdown/core-plugins/plugins/remark/ to import a plugin. For example, code-meta becomes @fluxdown/core-plugins/plugins/remark/code-meta.

    A check marks plugins included in PRESET_REMARK_PLUGINS, exported from @fluxdown/core-plugins/presets/remark. Core registers these automatically; add plugins without a check explicitly.

    PluginSubpathBuilt inPurpose
    ApplyRepairsRemarkPluginapply-repairsApplies repair plugins so unfinished Markdown has a suitable presentation at each stage.
    CjkRemarkPlugincjkImproves emphasis and bare-link parsing around CJK punctuation.
    CodeMetaRemarkPlugincode-metaPreserves metadata after a fenced code block's language label for renderers.
    EmojiRemarkPluginemojiConverts emoji shortcodes into Unicode emoji.
    PatchesRemarkPluginpatchesMarks text ranges that the app will replace with custom content.
    SyntaxAutolinkRemarkPluginsyntax-autolinkConverts recognized URLs and email addresses into links.
    SyntaxFootnoteRemarkPluginsyntax-footnoteSupports footnote references and definitions; requires build.footnote.
    SyntaxHtmlAllowedRemarkPluginsyntax-html-allowedControls which raw HTML tags are allowed and treats other tags as text.
    SyntaxMathRemarkPluginsyntax-mathSupports formulas and their intermediate streaming states; requires build.tex.
    SyntaxPolicyRemarkPluginsyntax-policyControls whether indented code blocks and Setext headings are enabled.
    SyntaxSoftEndlineRemarkPluginsyntax-soft-endlineDisplays plain newlines as line breaks.
    SyntaxStrikethroughRemarkPluginsyntax-strikethroughSupports strikethrough.
    SyntaxTableRemarkPluginsyntax-tableSupports Markdown tables.
    SyntaxTaskListRemarkPluginsyntax-task-listSupports task lists with checkboxes.
    TableNoralizerRemarkPlugintable-noralizerFills in table column alignment as the number of columns changes.