1.5.1 • Published 2 years ago

@nkduy/markdown v1.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@nkduy/markdown

markdown library for KduPress

Public API

PLUGINS

A map constant containing the names of all built-in markdown-it plugins.

isRequiredPlugin(pluginName: string)

  • Usage:
const { isRequiredPlugin } = require('@nkduy/markdown')
console.log(isRequiredPlugin(PLUGINS.COMPONENT)) // true
console.log(isRequiredPlugin(PLUGINS.HIGHLIGHT_LINES)) // false

removePlugin(config: chainMarkdown, pluginName: string)

Remove the specified built-in markdown-it plugin in KduPress.

  • Usage:
// Your KduPress Plugin or site config.
const { removePlugin } = require('@nkduy/markdown')
module.exports = {
  chainMarkdown (config) {
    removePlugin(config, PLUGINS.HIGHLIGHT_LINES)
  }
}

Note that PLUGINS.COMPONENT and PLUGINS.ANCHOR are required in KduPress, It is forbidden to delete them!

removeAllBuiltInPlugins(config: chainMarkdown)

Remove all built-in but not 100% necessary markdown-it plugins in KduPress.

  • Usage:
// Your KduPress Plugin or site config.
module.exports = {
  chainMarkdown (config) {
    require('@nkduy/markdown').removeAllBuiltInPlugins(config)
  }
}