FMHYedit/.vitepress/markdown/toggleStarred.ts
taskylizard c97a0abf92
🎉 New website!
2023-11-12 22:12:57 +05:30

18 lines
511 B
TypeScript

import type { MarkdownRenderer } from "vitepress";
const excluded = ["Beginners Guide"];
export function toggleStarredPlugin(md: MarkdownRenderer) {
md.renderer.rules.list_item_open = (tokens, index, options, env, self) => {
const contentToken = tokens[index + 2];
if (
!excluded.includes(env.frontmatter.title) &&
contentToken &&
contentToken.content.startsWith("⭐")
) {
return `<li class="starred">`;
}
return self.renderToken(tokens, index, options);
};
}