Skip to content

[Bug report] plugin-frontmatter - only works for render function. #13

Closed
@s-light

Description

@s-light

Description

with the current implementation the plugin-frontmatter only works if the render function is called.
there is a case (async plugin actions needed) where the official suggestion is to do the two steps of md.parse( and md.renderer.render( manually.
in this case this plugin does not work anymore.

the fix for this is very simple -
do the frontmatter extraction before the parse step.

i will add a PR

i discovered this issue while adding support for async actions to unplugin-vue-markdown
as it depends on plugin-frontmatter.
unplugin/unplugin-vue-markdown#63

Reproduction

https://github.com/s-light/unplugin-vue-markdown-playground

Used Package Manager

pnpm

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 14.16 GB / 31.15 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
    pnpm: 10.5.2 - ~/.nvm/versions/node/v22.14.0/bin/pnpm
  Browsers:
    Chromium: 133.0.6943.141
    Mozilla Firefox Snap for Ubuntu: 135.0.1 (64-bit)
  npmPackages:
    @eslint/js: ^9.20.0 => 9.21.0 
    @mdit-vue/plugin-frontmatter: ^2.1.3 => 2.1.3 
    @vitejs/plugin-vue: ^5.2.1 => 5.2.1 
    eslint: ^9.20.1 => 9.21.0 
    eslint-plugin-vue: ^9.32.0 => 9.33.0 
    highlight.js: ^11.11.1 => 11.11.1 
    markdown-it-async: ^2.1.0 => 2.1.0 
    markdown-it-prism: ^2.3.0 => 2.3.0 
    prismjs: ^1.29.0 => 1.29.0 
    unplugin-vue-markdown: ^28.3.1 => 28.3.1 
    vite: ^6.1.0 => 6.2.0 
    vite-plugin-vue-devtools: ^7.7.2 => 7.7.2 
    vue: ^3.5.13 => 3.5.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions