hexo-renderer-markdown-it
Advanced tools
Comparing version
@@ -25,3 +25,3 @@ 'use strict'; | ||
const { preset, render, enable_rules, disable_rules, plugins, anchors } = markdown; | ||
const { preset, render, enable_rules, disable_rules, plugins, anchors, images } = markdown; | ||
this.parser = new MarkdownIt(preset, render); | ||
@@ -49,2 +49,9 @@ | ||
} | ||
if (images) { | ||
this.parser.use(require('./images'), { | ||
images, | ||
hexo: this.hexo | ||
}); | ||
} | ||
} | ||
@@ -54,3 +61,5 @@ | ||
this.hexo.execFilterSync('markdown-it:renderer', this.parser, { context: this }); | ||
return this.parser.render(data.text); | ||
return this.parser.render(data.text, { | ||
postPath: data.path | ||
}); | ||
} | ||
@@ -57,0 +66,0 @@ } |
{ | ||
"name": "hexo-renderer-markdown-it", | ||
"version": "6.1.0", | ||
"version": "7.0.0", | ||
"description": "Markdown-it is a Markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.", | ||
@@ -34,4 +34,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"hexo-util": "^2.1.0", | ||
"markdown-it": "^12.0.0", | ||
"hexo-util": "^3.0.1", | ||
"markdown-it": "^13.0.1", | ||
"markdown-it-abbr": "^1.0.4", | ||
@@ -58,4 +58,4 @@ "markdown-it-attrs": "^4.1.3", | ||
"engines": { | ||
"node": ">=12.13.0" | ||
"node": ">=14" | ||
} | ||
} |
@@ -5,3 +5,2 @@ # hexo-renderer-markdown-it | ||
[](https://www.npmjs.com/package/hexo-renderer-markdown-it) | ||
[](https://david-dm.org/hexojs/hexo-renderer-markdown-it) | ||
[](https://coveralls.io/github/hexojs/hexo-renderer-markdown-it?branch=master) | ||
@@ -64,2 +63,6 @@ | ||
separator: '-' | ||
images: | ||
lazyload: false | ||
prepend_root: false | ||
post_asset: false | ||
``` | ||
@@ -337,2 +340,68 @@ | ||
## Frequently Asked Questions | ||
### Missing Styles of GFM Task Lists | ||
In general, adding the following styles to the theme can solve the problem. | ||
```css | ||
li.task-list-item { | ||
list-style-type: none; | ||
} | ||
li.task-list-item .task-list-item-checkbox { | ||
margin: 0 0.2em 0.25em -1.6em; | ||
} | ||
``` | ||
### How can I add math support? | ||
First, install KaTeX plugin for markdown-it. | ||
```bash | ||
npm install katex @renbaoshuo/markdown-it-katex | ||
``` | ||
Then add [`@renbaoshuo/markdown-it-katex`](https://github.com/renbaoshuo/markdown-it-katex) to plugins list. | ||
```yaml | ||
plugins: | ||
- '@renbaoshuo/markdown-it-katex' | ||
# Other plugins... | ||
``` | ||
If you need to allow spaces before and after delimiters (e.g. `$ 1 + 1 = 2 $`), set the `skipDelimitersCheck` option to `true`: | ||
```yaml | ||
plugins: | ||
- name: '@renbaoshuo/markdown-it-katex' | ||
options: | ||
skipDelimitersCheck: true | ||
``` | ||
Don't forget to include the KaTeX stylesheet in your html: | ||
```html | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css" | ||
/> | ||
``` | ||
### How can I merge table cells with the same content? | ||
Install the [`markdown-it-merge-cells`](https://github.com/Menci/markdown-it-merge-cells) plugin. | ||
```bash | ||
npm install markdown-it-merge-cells | ||
``` | ||
Then add the plugin to plugins list. | ||
```yaml | ||
plugins: | ||
- markdown-it-merge-cells | ||
# Other plugins... | ||
``` | ||
## Requests and bug reports | ||
@@ -339,0 +408,0 @@ |
20548
18.75%7
16.67%181
37.12%414
20%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated