包详细信息

@gerhobbelt/markdown-it-highlightjs

valeriangalliat12Unlicense3.1.0-7

Preset to use highlight.js with markdown-it.

markdown-it-plugin

自述文件

markdown-it-highlightjs npm version

Preset to use highlight.js with markdown-it.

Usage

const md = require('markdown-it')()
  .use(require('markdown-it-highlightjs'), opts)

// All code blocks will be highlighted.

The opts object can contain:

Name Type Description Default
auto boolean Whether to automatically detect language if not specified. true
code boolean Whether to add the hljs class to raw code blocks (not fenced blocks). true
register object Register other languages which are not included in the standard pack. null

Register languages

const md = require('markdown-it')()
  .use(require('markdown-it-highlightjs'), {
    register: {
      cypher: require('highlightjs-cypher')
    }
  })

更新日志

Changelog

This project adheres to Semantic Versioning.

Unreleased

3.0.0 - 2017-02-26

  • Update highlight.js. (#2)
  • Drop Babel. This drops support for Node.js versions that doesn't support ES6.

2.0.0 - 2015-06-29

  • Also add the hljs class to indented code blocks (together with fenced code blocks). This new behavior can be disabled with the code option.
  • Never automatically detect the language if a language was specified, even if not recognized.
  • Add an auto option to control if fenced code without language should be automatically highlighted.

1.1.2 - 2015-05-25

  • Update license format in package.json.

1.1.1 - 2015-03-27

  • Ensure hljs class is set even if no language is given.

1.1.0 - 2015-03-17

  • Add hljs class and langPrefix to code blocks.

1.0.0 - 2015-03-17

  • Initial release.