@kohaku/hexo-renderer-markdown-it
v0.0.3
Published
A faster and CommonMark compliant alternative for Hexo.
Downloads
1
Maintainers
Readme
Hexo Renderer Markdown-it
Modified from markdown-it-katex and hexo-renderer-markdown-it-plus. For better KaTeX writing experience. You can find the original README file in doc
.
Local Git: lilyknight/hexo-related/hexo-renderer-markdown-it
Github: https://github.com/ymd45921/hexo-renderer-markdown-it-plus
NPM:@kohaku/hexo-renderer-markdown-it
Usage
Recommend use it with hexo-theme-ymd45921
.
You should remove your previous Markdown renderer before install this.
yarn remove hexo-renderer-marked
yarn add @kohaku/hexo-renderer-markdown-it
Options
You can configure this renderer by adding a section to your hexo main _config.yml
file like below. Of course, do-nothing is also recommend.
ymd45921:
markdown_it:
highlight: true
html: true
xhtmlOut: true
breaks: true
langPrefix:
linkify: true
typographer:
quotes: “”‘’
plugins:
- plugin:
name: markdown-it-mark
enable: false
katex:
throwOnError: false
errorColor: '#c00'
strict: ignore # ignore | warn | error
output: # mathml | html | htmlAndMathml
leqno: false
fleqn: false
macros:
"\\and": "\\mathbb{∧}"
The plugins
object contains all plugins to markdown-it you want to add. If you want to add a plugin named as markdown-it-something
, you should install it as a dependency first, and add it to the plugins
object as provided format.
The katex
object contains options that directly apply to KaTeX. Some options' meaning is as follows:
throwOnError
: when error occurred in KaTeX parsing, renderer will return the TeX formula if it set totrue
, or try to continue the parse by ignoring the part of the parse that went wrong.errorColor
: whilethrowOnError
set tofalse
, renderer will set the ignored part to this color.output
: determines the markup language of the output. Valid choices includes MathML, HTML and both.
You can also check the KaTeX official doc to see what other key does in the example above.
Some notes
If you set katex output format to HTML
, you should import KaTeX's stylesheet in your webpage to ensure rendered block displays correctly in browsers.
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/katex.min.css">
Alternatively, if you set MathML
as output, which will place rendered results to <math>
blocks that have long been supported by Firefox long, and are supported by most modern browsers today.