1.0.1 • Published 5 years ago

@juexro/markdown-it-highlight-code-block v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

markdown-it-highlight-code-block

rewrite default_rules.code_block for markdown-it in nodejs.

install

yarn add markdown-it-highlight-code-block -D

usage

const fs = require('fs')
let fileContent = fs.readFileSync('markdown.md', 'utf8')
const style = fs.readFileSync('node_modules/highlight.js/styles/github.css')

const MarkdownIt = require('markdown-it')
const CodeBlockPlugin = require('@juexro/markdown-it-highlight-code-block')
const md = new MarkdownIt().use(CodeBlockPlugin)

fs.writeFileSync('markdown.html', `<style>${style}</style>` + md.render(fileContent))