Skip to content

Shiki syntax highlight support #2530

Description

@noraj

Feature request

Problem or desire

Prism syntax highlight is quite bad (highlight.js is bad too).

Proposal

Support Shiki.

Shiki has better syntax highlight because it uses TextMate grammar instead of shady regexp. It uses the same engine as in VS Code.

Implementation

I guess the only thing to do on doscify side, is to add a config option that allows to generate a different highlighter class prefix. That way all JS syntax highlighter could nearly be supported.

  • shiki: css class shiki
  • prism: css class language- prefix
  • highlightjs: css class hljs

https://shiki.style/guide/install#cdn-usage

Activity

  1. added this to the 5.x milestone on Feb 26, 2025
  2. Koooooo-7 commented on Jul 18, 2025

    @Koooooo-7
    Member

    Hi @noraj , As per the requirement that customizing the code block class, I think it is feasible for now.
    You could register a customer renderer for code.

       window.$docsify = {
            markdown: {
              renderer: {
                code({ text, lang }) {
                  return /* customized code block */ `<pre data-lang="${lang}" class="shiki language-${lang}"><code class="lang-${lang} language-${lang}" tabindex="0">${text}</code></pre>`;
                },
              },
            },
        }

    Not quite sure whether Shiki support static css add-on styling for code hightlight, glad to see ur feedback on it!

  3. AhmedAlaa4611 commented on Oct 3, 2025

    @AhmedAlaa4611

    Hello @noraj

    Yes, I think so. I'm new to Docsify, and I've created a new project to try it out, but it doesn't seem to highlight anything.

  4. RedCMD commented on Oct 3, 2025

    @RedCMD

    it uses TextMate grammar instead of shady regexp

    @noraj TextMate grammars are regexp based?

  5. hiSandog commented on Jun 30, 2026

    @hiSandog

    Shiki support would be a nice upgrade, but the integration should probably account for its async highlighter setup and theme loading. A good first version could expose Shiki as an optional plugin that preloads configured languages/themes, then falls back gracefully when a language is missing. That keeps the core lightweight while giving users a path to modern highlighting.

  6. sy-records commented on Jul 3, 2026

    @sy-records
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions