Skip to content
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

[Feature request] plugin-shiki migrate to use shikiji #12

Closed
meteorlxy opened this issue Dec 21, 2023 · 6 comments · Fixed by #13
Closed

[Feature request] plugin-shiki migrate to use shikiji #12

meteorlxy opened this issue Dec 21, 2023 · 6 comments · Fixed by #13
Assignees
Labels

Comments

@meteorlxy
Copy link
Member

Clear and concise description of the problem

Shikiji is a pure esm rewrite of shiki, with some improvement.

Suggested solution

Migrate from shiki to shikiji. No need to update the plugin name, as shikiji might become shiki 1.0 in the future

Alternative

No response

Additional context

No response

@nruffing
Copy link
Contributor

@meteorlxy @Mister-Hope

Looking for someone to pick this up? I would be happy to help.

@Mister-Hope
Copy link
Member

sure, just pick it up. I am really busy with my article

@nruffing
Copy link
Contributor

It doesn't look like I have permissions to assign the issue to myself but I will start working on this.

@nruffing
Copy link
Contributor

nruffing commented Dec 23, 2023

Actually, is plugin-shiki even necessary anymore? Should we just use markdown-it-shikiji directly now?

@meteorlxy
Copy link
Member Author

meteorlxy commented Dec 23, 2023

@nruffing As I remember, that plugin has its own highlightLine and language class implementation. I'm not sure if that's compatible with our default theme, or may introduce some breaking change to theme authors. You can investigate a little more about that.

@nruffing
Copy link
Contributor

nruffing commented Dec 24, 2023

The breaking changes between shiki and shikiji are documented here. There is a shim build that restores most of them if necessary but there are still a couple potential breaking changes to theme developers (e.g. the css-variables theme is no longer supported).

It does appear that other than the css-variables theme all the same languages and themes are supported but the options contract passed to codeToHtml is changed to allow for dark and light themes to be configured. It also looks like the rendered markup is likely to be different as well.

We might be able to have the plugin use markdown-it-shikiji and shim the options to maybe support both the current themes type and the existing one but ultimately its a breaking change that seems like should be migrated to at some point.

The simple solution here though might be to just leave the shiki plugin as it is, migrate the vuepress docs to use markdown-it-shikiji directly, and update docs to recommend transitioning to this approach.

UPDATE: Using markdown-it-shikiji is actually not going to work because that changes the order of operations and the highlighting happens before vue processing and it breaks v-pre handling.

nruffing added a commit to nruffing/vuepress-ecosystem that referenced this issue Dec 24, 2023
meteorlxy added a commit that referenced this issue Dec 28, 2023
BREAKING CHANGE: now `langs` option is required, you need to set the languages list explicitly

Co-authored-by: meteorlxy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants