Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
s-light opened this issue Mar 6, 2025 · 0 comments · Fixed by #14
Closed

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

s-light opened this issue Mar 6, 2025 · 0 comments · Fixed by #14

Comments

@s-light
Copy link
Contributor

s-light commented Mar 6, 2025

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant