fix: switch to `markdown-it-toc-done-right` (#388) (#660)

fix #388
pull/665/head
Divyansh Singh 3 years ago committed by GitHub
parent 6028cacb81
commit 7d89b61b92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -121,8 +121,8 @@ interface MarkdownOptions extends MarkdownIt.Options {
allowedAttributes?: string[] allowedAttributes?: string[]
} }
// markdown-it-table-of-contents cplugin options // markdown-it-toc-done-right plugin options
// https://github.com/Oktavilla/markdown-it-table-of-contents // https://github.com/nagaozen/markdown-it-toc-done-right
toc?: any toc?: any
// Configure the Markdown-it instance to fully customize // Configure the Markdown-it instance to fully customize

@ -403,8 +403,8 @@ module.exports = {
permalink: anchor.permalink.headerLink() permalink: anchor.permalink.headerLink()
}, },
// options for markdown-it-table-of-contents // options for markdown-it-toc-done-right
toc: { includeLevel: [1, 2] }, toc: { level: [1, 2] },
config: (md) => { config: (md) => {
// use more markdown-it plugins! // use more markdown-it plugins!

@ -124,7 +124,7 @@
"markdown-it-attrs": "^4.1.3", "markdown-it-attrs": "^4.1.3",
"markdown-it-container": "^3.0.0", "markdown-it-container": "^3.0.0",
"markdown-it-emoji": "^2.0.0", "markdown-it-emoji": "^2.0.0",
"markdown-it-table-of-contents": "^0.6.0", "markdown-it-toc-done-right": "^4.2.0",
"micromatch": "^4.0.4", "micromatch": "^4.0.4",
"minimist": "^1.2.5", "minimist": "^1.2.5",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",

File diff suppressed because it is too large Load Diff

@ -17,7 +17,7 @@ import { Header } from '../shared'
import anchor from 'markdown-it-anchor' import anchor from 'markdown-it-anchor'
import attrs from 'markdown-it-attrs' import attrs from 'markdown-it-attrs'
import emoji from 'markdown-it-emoji' import emoji from 'markdown-it-emoji'
import toc from 'markdown-it-table-of-contents' import toc from 'markdown-it-toc-done-right'
export interface MarkdownOptions extends MarkdownIt.Options { export interface MarkdownOptions extends MarkdownIt.Options {
lineNumbers?: boolean lineNumbers?: boolean
@ -31,7 +31,7 @@ export interface MarkdownOptions extends MarkdownIt.Options {
allowedAttributes?: string[] allowedAttributes?: string[]
} }
theme?: Theme theme?: Theme
// https://github.com/Oktavilla/markdown-it-table-of-contents // https://github.com/nagaozen/markdown-it-toc-done-right
toc?: any toc?: any
externalLinks?: Record<string, string> externalLinks?: Record<string, string>
} }
@ -89,8 +89,9 @@ export const createMarkdownRenderer = async (
}) })
.use(toc, { .use(toc, {
slugify, slugify,
includeLevel: [2, 3], level: [2, 3],
format: parseHeader, format: parseHeader,
listType: 'ul',
...options.toc ...options.toc
}) })
.use(emoji) .use(emoji)

@ -8,11 +8,6 @@ declare module 'markdown-it-emoji' {
export default def export default def
} }
declare module 'markdown-it-table-of-contents' {
const def: any
export default def
}
declare module 'markdown-it-container' { declare module 'markdown-it-container' {
const def: any const def: any
export default def export default def

Loading…
Cancel
Save