mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-09 05:16:23 +10:00
feat($markdown): pass rest options to instantiate markdown-it
Close: #1040 e.g. markdown: { config: md => { md.set({linkify: true}); } } shortcut: markdown: { linkify: true },
This commit is contained in:
@@ -25,17 +25,18 @@ const { parseHeaders, slugify: _slugify, logger, chalk } = require('@vuepress/sh
|
||||
* Create markdown by config.
|
||||
*/
|
||||
|
||||
module.exports = ({
|
||||
slugify,
|
||||
externalLinks,
|
||||
anchor,
|
||||
toc,
|
||||
lineNumbers,
|
||||
beforeInstantiate,
|
||||
afterInstantiate
|
||||
} = {}) => {
|
||||
module.exports = (markdown = {}) => {
|
||||
const {
|
||||
externalLinks,
|
||||
anchor,
|
||||
toc,
|
||||
lineNumbers,
|
||||
beforeInstantiate,
|
||||
afterInstantiate
|
||||
} = markdown
|
||||
|
||||
// allow user config slugify
|
||||
slugify = slugify || _slugify
|
||||
const slugify = markdown.slugify || _slugify
|
||||
|
||||
// using chainedAPI
|
||||
const config = new Config()
|
||||
@@ -110,7 +111,7 @@ module.exports = ({
|
||||
|
||||
beforeInstantiate && beforeInstantiate(config)
|
||||
|
||||
const md = config.toMd()
|
||||
const md = config.toMd(require('markdown-it'), markdown)
|
||||
|
||||
afterInstantiate && afterInstantiate(md)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@vuepress/shared-utils": "^1.0.0-alpha.24",
|
||||
"markdown-it": "^8.4.1",
|
||||
"markdown-it-anchor": "^5.0.2",
|
||||
"markdown-it-chain": "^1.2.1",
|
||||
"markdown-it-chain": "^1.3.0",
|
||||
"markdown-it-container": "^2.0.0",
|
||||
"markdown-it-emoji": "^1.4.0",
|
||||
"markdown-it-table-of-contents": "^0.4.0",
|
||||
|
||||
@@ -5556,9 +5556,9 @@ markdown-it-anchor@^5.0.2:
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-5.0.2.tgz#cdd917a05b7bf92fb736a6dae3385c6d0d0fa552"
|
||||
|
||||
markdown-it-chain@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/markdown-it-chain/-/markdown-it-chain-1.2.1.tgz#eb77a8dc06265d48d0b6c729170e391902db22cb"
|
||||
markdown-it-chain@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "http://registry.npm.taobao.org/markdown-it-chain/download/markdown-it-chain-1.3.0.tgz#ccf6fe86c10266bafb4e547380dfd7f277cc17bc"
|
||||
dependencies:
|
||||
webpack-chain "^4.9.0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user