docmachine-containers/.marp/engine.js

23 lines
609 B
JavaScript
Raw Normal View History

2020-04-19 10:04:32 +00:00
// engine.js
// You have to run `npm i @marp-team/marp-core` at first.
const { Marp } = require('@marp-team/marp-core')
2024-02-16 22:56:36 +00:00
const highlightLines = require('markdown-it-highlight-lines')
2020-04-19 10:04:32 +00:00
module.exports = opts => {
2020-09-29 14:42:37 +00:00
opts.markdown = { ...opts.markdown }
opts.markdown.breaks = false
opts.markdown.html = true
opts.html = true
// console.log(opts)
2020-04-19 10:04:32 +00:00
const marp = new Marp(opts)
// Disable parsing fragmented list
marp.markdown.core.ruler.disable('marpit_fragment')
2024-02-16 22:56:36 +00:00
// Enable code lines highlighting
// ref. https://github.com/marp-team/marp-vscode/issues/146
return marp.use(highlightLines)
2020-04-19 10:04:32 +00:00
}