hexo-shiki-highlighter

0.1.0 • Public • Published

Shiki Highlighter for Hexo

npm-image license-image

A hexo plugin to use Shiki 式 as code block highlighter, which is accurate and powerful.

Hexo v7.0.0+ is required, due to highlighter api and top-level await support.

Features

  • Accurate and powerful syntax highlighting.
  • Line marker support. (This highlighter only adds .marked class to the line, you need to style it yourself.)
  • Support code block with caption. (You may need to style it yourself.)

Setup

First, install this package.

pnpm add hexo-shiki-highlighter

Then, switch the highlighter to shiki in your _config.yml.

syntax_highlighter: "shiki"

Finally, configure the options for shiki in your _config.yml.

shiki:
  theme: "dark-plus"
  strip_indent: true # Strip the leading indent of the code block (default: true, just like the official highlighter)

Usage

You can use the normal backtick code block to highlight your code, but if you want more control, use the codeblock tag, just like the official highlighter (e.g. highlight.js or prismjs).

{% codeblock pyproject.toml lang:toml mark:2 %}
[tool.poetry]
package-mode = false
{% endcodeblock %}

Package Sidebar

Install

npm i hexo-shiki-highlighter

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

12.4 MB

Total Files

5

Last publish

Collaborators

  • alampy