-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(build): improve code blocks and snippets #875
Conversation
Shouldn't It recognize the language by the extension? and so on? |
@emersonbottero Read this section https://deploy-preview-875--vitepress-docs.netlify.app/guide/markdown.html#import-code-snippets You'll have to provide language in case of C#. For I have not implemented language-extension mapping because it will be a fairly long list that we'll need to hard code. It is better to rely on users to override the detected language (the extension of file). (If your file extension is in this list, then you don't need to specify language: https://github.com/shikijs/shiki/blob/main/docs/languages.md#all-languages) |
Oh.. Ho, If I ask tô chance |
Yeah it would work then. BTW how frequently do you import snippets? There won't be much IG, so |
The syntax from markdown-it-vuepress-code-snippet-enhanced looks more markdown-like and extendable (I saw you have noticed that @brc-dd ), so I chose to implement it in vuepress-next (not as powerful as that plugin though). Anyway, the |
But I don't think it supports importing regions from files. Or does it? Probably that |
It does: https://github.com/fabioaanthony/markdown-it-vuepress-code-snippet-enhanced#transclusion I'd say that plugin is really powerful 😅 |
@meteorlxy So should we go ahead with this PR or implement that syntax? This PR fixes two other issues, I'll split it. We can track snippets (#861) separately from issues with code blocks. |
even with the plugin I think it still makes sense to keep it in vitepress since it already has the feature to import code out of the box. |
Let's merge this for now, we can work on changing the importing format later. |
fixes: