ele828 / hexo-prism-plugin

Hexo plugin for code highlighting by prism.js, supporting JSX syntax
204 stars 51 forks source link
hexo highlight plugin prism

Hexo-Prism-Plugin NPM

Since highlight.js didn't support JSX syntax properly, I wrote this plugin to replace Hexo's default code highlight plugin.

Install

npm i -S hexo-prism-plugin

Usage

Firstly, you should edit your _config.yml by adding following configuration.

prism_plugin:
  mode: 'preprocess'    # realtime/preprocess
  theme: 'default'
  line_number: false    # default false
  custom_css: 'path/to/your/custom.css'     # optional

After that, check highlight option in _config.yml. Make sure that default code highlight plugin is disabled.

highlight:
  enable: false

Finally, clean and re-generate your project by running following commands:

hexo clean
hexo generate

Options

Themes

You can check out prism-themes project for additional theme preview:

https://github.com/PrismJS/prism-themes#available-themes

Supported languages

You could find the supported languages here:

http://prismjs.com/#languages-list

License

MIT