-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
snippet plugin root params Missing default value #204
Conversation
Why does it need this? Making it optional makes it possible for other parts of the codebase to forget it and lead to potential errors. |
Now introducing a block of code in Markdown using the @ sign will result in undefined, and when Markdown-it uses SnippetPlugin, no parameters are defined, so provide a default value to keep its behavior consistent with VuePress |
What kind of markdown causes this problem? I'd help to at least have an example. When submitting PRs, it's better to provide enough context upfront since we don't necessarily know what problem you are actually dealing with. |
I'm sorry, this is a case where I had a problem: |
Oh OK now I see the problem. So export function createMarkdownToVueRenderFn(
root: string,
options: MarkdownOptions = {}
) {
const md = createMarkdownRenderer(options, root) // <- pass root
... export const createMarkdownRenderer = (
root: string, // <- add
options: MarkdownOptions = {}
): MarkdownRenderer => {
const md = MarkdownIt({
html: true,
linkify: true,
highlight,
...options
})
// custom plugins
md.use(componentPlugin)
...
.use(snippetPlugin, root) // <- pass in root
... @hcg1023 Would you like to update the PR? |
yes
Yes, I have updated my Commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update and finding the issue! 🙌
No description provided.