Skip to content

Commit 1b9012e

Browse files
meteorlxyulivz
authored andcommitted
fix: emoji doesn't work in toc (close: #417) (#418)
1 parent 5caefd9 commit 1b9012e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/markdown/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const emoji = require('markdown-it-emoji')
88
const anchor = require('markdown-it-anchor')
99
const toc = require('markdown-it-table-of-contents')
1010
const _slugify = require('./slugify')
11+
const { parseHeaders } = require('../util')
1112

1213
module.exports = ({ markdown = {}} = {}) => {
1314
// allow user config slugify
@@ -37,7 +38,8 @@ module.exports = ({ markdown = {}} = {}) => {
3738
}, markdown.anchor))
3839
.use(toc, Object.assign({
3940
slugify,
40-
includeLevel: [2, 3]
41+
includeLevel: [2, 3],
42+
format: parseHeaders
4143
}, markdown.toc))
4244

4345
// apply user config

lib/util/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const spawn = require('cross-spawn')
22
const parseHeaders = require('./parseHeaders')
33

4+
exports.parseHeaders = parseHeaders
5+
46
exports.normalizeHeadTag = tag => {
57
if (typeof tag === 'string') {
68
tag = [tag]

0 commit comments

Comments
 (0)