Skip to content

Commit e1201d9

Browse files
release: v7.0.0
1 parent 7e5dde1 commit e1201d9

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# hexo-renderer-marked
22

3-
[![Build Status](https://github.com/hexojs/hexo-renderer-marked/workflows/Tester/badge.svg?branch=master)](https://github.com/hexojs/hexo-renderer-marked/actions?query=workflow%3ATester)
3+
[![Tester](https://github.com/hexojs/hexo-renderer-marked/actions/workflows/tester.yml/badge.svg?branch=master)](https://github.com/hexojs/hexo-renderer-marked/actions/workflows/tester.yml)
44
[![NPM version](https://badge.fury.io/js/hexo-renderer-marked.svg)](https://www.npmjs.com/package/hexo-renderer-marked)
55
[![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-renderer-marked.svg)](https://coveralls.io/r/hexojs/hexo-renderer-marked?branch=master)
66
[![NPM Dependencies](https://img.shields.io/librariesio/release/npm/hexo-renderer-marked.svg)](https://libraries.io/npm/hexo-renderer-marked)
@@ -20,7 +20,7 @@ There are two solutions to avoid those issues:
2020

2121
## Installation
2222

23-
``` bash
23+
```bash
2424
$ npm install hexo-renderer-marked --save
2525
```
2626

@@ -32,7 +32,7 @@ $ npm install hexo-renderer-marked --save
3232

3333
You can configure this plugin in `_config.yml`.
3434

35-
``` yaml
35+
```yml
3636
marked:
3737
gfm: true
3838
pedantic: false
@@ -83,7 +83,7 @@ marked:
8383
- **figcaption** - Append `figcaption` element after each image.
8484
- **prependRoot** - Prepend root value to (internal) image path.
8585
* Example `_config.yml`:
86-
``` yml
86+
```yml
8787
root: /blog/
8888
```
8989
* `![text](/path/to/image.jpg)` becomes `<img src="/blog/path/to/image.jpg" alt="text">`
@@ -112,7 +112,7 @@ For more options, see [Marked](https://marked.js.org/using_advanced#options). Du
112112

113113
To enable it, pass an object containing the DOMPurify options:
114114

115-
```json
115+
```yml
116116
dompurify: true
117117
```
118118

@@ -173,10 +173,11 @@ This plugin overrides some default behaviours of how [marked] plugin renders the
173173

174174
For example, to override how heading like `# heading text` is rendered:
175175

176-
``` js
176+
```js
177177
hexo.extend.filter.register('marked:renderer', function(renderer) {
178178
const { config } = this; // Skip this line if you don't need user config from _config.yml
179-
renderer.heading = function(text, level) {
179+
renderer.heading = function({ tokens, depth: level }) {
180+
const text = this.parser.parseInline(tokens);
180181
// Default behaviour
181182
// return `<h${level}>${text}</h${level}>`;
182183
// outputs <h1>heading text</h1>
@@ -196,7 +197,7 @@ Notice `renderer.heading = function (text, level) {` corresponds to [this line](
196197

197198
It is also possible to customize the [tokenizer](https://marked.js.org/using_pro#tokenizer).
198199

199-
``` js
200+
```js
200201
const { escapeHTML: escape } = require('hexo-util');
201202

202203
// https://github.com/markedjs/marked/blob/b6773fca412c339e0cedd56b63f9fa1583cfd372/src/Lexer.js#L8-L24

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hexo-renderer-marked",
3-
"version": "6.3.0",
3+
"version": "7.0.0",
44
"description": "Markdown renderer plugin for Hexo",
55
"main": "index",
66
"scripts": {

0 commit comments

Comments
 (0)