Closed Mister-Hope closed 1 month ago
A crucial missing parameter is at codePlugin/codePlugin.ts#L76 where the third argument of options.highlight(code, lang, meta)
should be passed as token.info
instead of an empty string. Some transformers
when using shiki
can be controlled based on token.info
.
When using twoslash with VuePress, the line numbers are not functioning properly. This is because twoslash inserts additional <span>xx</span>\n
into <code>
, causing miscalculation of extra lines due to line numbers being counted based on \n
. In plugin-shiki, there is no control over line-numbers
.
Can you open a pr for this? And maybe removing the line number plugin and implement it in plugin-prismjs
?
Can you open a pr for this? And maybe removing the line number plugin and implement it in
plugin-prismjs
?
Currently, the adjustment plan involves removing the codePlugin
from @vuepress/markdown
and transferring its functionality to be independently implemented in @vuepress/plugin-prismjs
and @vuepress/plugin-shiki
.
You can open a pr to remove it, and use a patch to have plugin-prismjs and plugin-shiki implement the original feature, and we can then moving on upstream here.
Clear and concise description of the problem
Our built-in plugins about code fence are breaking shiki highlighter, e.g., shiki has an own implementation about higlight lines, and shiki's twoslash is powerful
See https://plume.pengzhanbo.cn/guide/markdown/experiment/#%E5%BC%80%E5%90%AF%E5%8A%9F%E8%83%BD as an example, the community is patching our official pacakge to bypass this.
Suggested solution
Move the highlight lines and line number part into @vuepress/plugin-prismjs and @vuepress/plugin-shiki so that users can do more things with shiki and do not break current prismjs behvaior.
Alternative
No response
Additional context
I am planning to migrate the default highlighter to shiki for theme default.