[ANN] PkgTemplatesShikiPlugin.jl - Add ShikiStyle Syntax Highlighting (Presenting at JuliaLang Japan 2025, Dec 13)

I’m excited to announce PkgTemplatesShikiPlugin.jl! :tada:

This plugin makes it easy to add beautiful, VS Code-quality syntax highlighting to your Julia package documentation.

TL;DR - Try it now!

using PkgTemplates, PkgTemplatesShikiPlugin

t = Template(;
    user="YourName",
    plugins=[
        GitHubActions(),
        DocumenterShiki{GitHubActions}() ##
    ]
)

t("MyPackage")

Your new package will have beautiful syntax highlighting powered by Shiki! :sparkles:

Demo

See it in action: DocumenterShikiDemo.jl

Compare the syntax highlighting quality and check out the unique multi-line background coloring feature.

What You Get

  • VS Code-quality syntax highlighting: Powered by Shiki, which uses the same TextMate grammars as VS Code
  • Automatic setup: No manual configuration needed - everything is set up when you create your package
  • Multi-line background coloring: Unique feature that adds background colors based on nesting levels, making code structure more visible
  • Works with existing Documenter.jl workflow: No need to change your documentation workflow

Quick Start

Installation

using Pkg
Pkg.add("PkgTemplates")
Pkg.add("PkgTemplatesShikiPlugin")

Creating a New Package

using PkgTemplates, PkgTemplatesShikiPlugin

t = Template(;
    user="YourGitHubUsername",
    plugins=[
        GitHubActions(),
        DocumenterShiki{GitHubActions}()
    ]
)

t("MyAwesomePackage")

That’s it! Your package now has Shiki-powered syntax highlighting.

What Gets Generated

The plugin automatically:

  • Adds DocumenterShiki configuration to your docs/make.jl
  • Includes the necessary ShikiHighlighter.jl module
  • Sets up GitHub Actions to build and deploy your docs with Shiki highlighting
  • Configures themes (light/dark mode support)

Background: Why This Plugin?

Currently, Documenter.jl uses highlight.js for syntax highlighting. While @fredrikekre greatly improved Julia support in highlight.js (see his blog post), it still has limitations due to being regex-based.

The community has been discussing better syntax highlighting solutions (see Documenter.jl issue #2224), where @rbeeli created a proof-of-concept Shiki integration. Other options like JuliaSyntaxHighlighting.jl have also been discussed, but these solutions are not yet integrated into Documenter.jl.

There’s also DocumenterVitepress.jl, which leverages VitePress’s built-in Shiki support. However, migrating existing projects to VitePress requires significant changes to your documentation workflow.

PkgTemplatesShikiPlugin takes a different approach:

  • Extends Documenter.jl directly with Shiki support
  • Maintains your existing Documenter.jl workflow
  • Makes it easy to start new projects with high-quality syntax highlighting

Links

Feedback Welcome!

I’d love to hear your thoughts and feedback. Please try it out and let me know what you think!

If you encounter any issues or have suggestions, please open an issue on GitHub.

Happy documenting! :books:

Upcoming Talk

JuliaLang Japan 2025 - December 13, 2025, 13:00-18:20 JST. Available online via Zoom. The talk will be in Japanese only, sorry!

13 Likes

Love this! Better syntax highlighting would across the ecosystem would be awesome.
Here’s a link to the comparison gallery for curious folks:

1 Like