hexo-lute

1.1.1 • Public • Published

hexo-lute

npm version MIT license travis code size

A markdown renderer for Hexo based on Lute.

Installations

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 yarn

Configuration

The 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 default
  • gfm: GitHub flavored markdown
  • breaks: 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.io will become <a href="https://hexo.io">https://hexo.io</a>.
  • emoji: Emoji support. E.g. :heart: will become ❤️.
  • prepend_root: Prepend config.root value 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 original src will then become data-src.
  • lazyload_src: Set a new src after original src became data-src. Useful for a placeholder (small "loading" gif things).
    • If lazyload is set to true and lazyload_src is unset or empty, data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs= will be use then.
  • 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).

Performance

  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).

License

MIT License

Maintainer

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

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i hexo-lute

    Weekly Downloads

    1

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    2.6 MB

    Total Files

    6

    Last publish

    Collaborators

    • sukkaw