Skip to content
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

[FR] Frontmatter config to disable <> tags parsing #4622

Open
4 tasks done
kawaaii opened this issue Mar 15, 2025 · 9 comments
Open
4 tasks done

[FR] Frontmatter config to disable <> tags parsing #4622

kawaaii opened this issue Mar 15, 2025 · 9 comments
Labels
build Related to the build system has-workaround Has workaround, low priority

Comments

@kawaaii
Copy link

kawaaii commented Mar 15, 2025

Is your feature request related to a problem? Please describe.

Currently using vitepress to render changelogs of a repository, and it has entries like:
Add <partition>/gpu support to fsgen

which leads to missing end tag.

Describe the solution you'd like

I believe adding a frontmatter config to parse elements in a MD or not, would be a good idea.

Describe alternatives you've considered

No response

Additional context

#4216

Seems to be stale, and I am not sure if this will be given any attention considering 4 months of inactivity on that issue.

Validations

@brc-dd
Copy link
Member

brc-dd commented Mar 15, 2025

It's hard to do that on per-page basis. You can configure it globally, but then you won't be able to use any kind of html in your markdown files:

import { defineConfig } from 'vitepress';

export default defineConfig({
  markdown: {
    html: false,
  },
});

I'd recommend just escape it manually - Add &lt;partition&gt;/gpu support to fsgen

@kawaaii
Copy link
Author

kawaaii commented Mar 15, 2025

Yeah well it's just on that specific page only :(

https://blog.pixelos.net/changelogs

@kawaaii
Copy link
Author

kawaaii commented Mar 15, 2025

I'd recommend just escape it manually - Add &lt;partition&gt;/gpu support to fsgen

These are generated automatically on each day using a script, which grabs all the changelogs from the repositories through GH APIs.

@brc-dd
Copy link
Member

brc-dd commented Mar 15, 2025

try this:

import { defineConfig } from 'vitepress';

export default defineConfig({
  markdown: {
    config(md) {
      const orig = md.render;
      md.render = function (src, env) {
        if (env.relativePath === 'index.md') {
          src = src.replace(/</g, '&lt;').replace(/>/g, '&gt;');
        }
        return orig.call(this, src, env);
      };
    },
  },
});

replace index.md with whatever your file's name is

@kawaaii
Copy link
Author

kawaaii commented Mar 15, 2025

try this:

import { defineConfig } from 'vitepress';

export default defineConfig({
markdown: {
config(md) {
const orig = md.render;
md.render = function (src, env) {
if (env.relativePath === 'index.md') {
src = src.replace(/</g, '<').replace(/>/g, '>');
}
return orig.call(this, src, env);
};
},
},
});
replace index.md with whatever your file's name is

This led me into facing another issue. xD

@kawaaii
Copy link
Author

kawaaii commented Mar 15, 2025

Source: https://github.com/PixelOS-AOSP/blog

@brc-dd
Copy link
Member

brc-dd commented Mar 15, 2025

Seems to work fine:

Image

This led me into facing another issue. xD

What's the issue?

@kawaaii
Copy link
Author

kawaaii commented Mar 15, 2025

Worked fine.
My bad.

@kawaaii
Copy link
Author

kawaaii commented Mar 15, 2025

I still wish if there was the frontmatter config though.
Maybe can add this to "TODO" list?

@brc-dd brc-dd added build Related to the build system has-workaround Has workaround, low priority labels Mar 15, 2025
kawaaii pushed a commit to PixelOS-AOSP/blog that referenced this issue Mar 15, 2025
https: //github.com/vuejs/vitepress/issues/4622
Change-Id: I917e1576ca11d187503c9c816be10dcc713df9d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to the build system has-workaround Has workaround, low priority
Projects
None yet
Development

No branches or pull requests

2 participants