A markdown renderer for Hexo based on Lute.
Make sure you have existed markdown renderer uninstalled:
hexo-renderer-marked- The default markdown renderer shipped with Hexo.hexo-renderer-markdown-it- Another official markdown renderer made by Hexo.
Then install hexo-lute with following command:
$ npm i hexo-lute --save
# yarn add hexo-lute # if you prefer yarnThe default behavior of hexo-lute is nearly the same as hexo-renderer-marked with default configuration.
You can configure this plugin in _config.yml to enable extra features.
lute:
gfm: true # Enabled by default
breaks: true # Enabled by default
header_id: true # Enabled by default
autolink: true # Enabled by default
emoji: false # Disabled by default
prepend_root: false # Disabled by default
sanitize: false # Disabled by default
lazyload: false # Disabled by default
lazyload_src: ''
github_todo_list: false # Disabled by default
github_todo_list_class: 'task-list'
fix_term_typo: false # Disabled by default
auto_space: false # Disabled by default
chinese_punct: false # Disabled by defaultgfm: GitHub flavored markdownbreaks: Treats soft break as a hard break, just like GitHub Issues.header_id: Insert header id, e.g.<h1 id="text">text</h1>. Useful for inserting anchor link to each paragraph with a heading.autolink: Enable autolink for URLs. E.g.https://hexo.iowill become<a href="https://hexo.io">https://hexo.io</a>.emoji: Emoji support. E.g.:heart:will become❤️.prepend_root: Prependconfig.rootvalue to internal image url & relative link.sanitize: Basic XSS filter based on bluemonday. Please just don't rely on it.lazyload: Enable lazyload for image. The originalsrcwill then becomedata-src.lazyload_src: Set a newsrcafter originalsrcbecamedata-src. Useful for a placeholder (small "loading" gif things).- If
lazyloadis set totrueandlazyload_srcis unset or empty,data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=will be use then.
- If
github_todo_list: GFM Todo List support.github_todo_list_class: The class name for GFM Todo List support, useful for styling.fix_term_typo: Enable some coding term correction (e.g.Github => GitHub,jquery => jQuery, etc.)auto_space: Add a space between CJK character and other characters.chinese_punct: Replace the English punctuation to Chinese punctuation (punctuation between Chinese words only).
Benchmark
✓ hexo-lute (324ms)
✓ hexo-renderer-marked (41ms)
It shows that hexo-lute is 7x slower than hexo-renderer-marked. But hexo-lute could be faster under specific circumstances (shorter & simpler posts).
hexo-lute © Sukka, Released under the MIT License.
Authored and maintained by Sukka with help from contributors (list).
Personal Website · Blog · GitHub @SukkaW · Telegram Channel @SukkaChannel · Twitter @isukkaw · Keybase @sukka