You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Importing code snippets currently uses the filename extension as the prism language. While this is fine for things like test.html and test.js, when you're using something like Makefile or Program.cs, the parser fails or prism gets a language specifier it doesn't understand. If prism language can be set specifically in an snippet import line, it'd be easier than trying to guess.
Uh oh!
There was an error while loading. Please reload this page.
Feature request
What problem does this feature solve?
Importing code snippets currently uses the filename extension as the prism language. While this is fine for things like test.html and test.js, when you're using something like Makefile or Program.cs, the parser fails or prism gets a language specifier it doesn't understand. If prism language can be set specifically in an snippet import line, it'd be easier than trying to guess.
See #1189 for more info.
What does the proposed API look like?
A "lang=[prism language name]" token added to the import snippet line. Preferably before the file URI.
"=" is used because ":" is already caught in the regex later for the path, not sure what the : is used for otherwise but didn't want to conflict.
How should this be implemented in your opinion?
Should be able to add it to vuepress/packages/@vuepress/markdown/lib/snippet.js. That's already just hand-parsing the line anyways.
Are you willing to work on this yourself?**
Yup. Shouldn't be too difficult, just want to make sure the format is acceptable before putting in a PR.
The text was updated successfully, but these errors were encountered: