Skip to content

Commit a3e5915

Browse files
committed
Add marp example.
1 parent e432eb3 commit a3e5915

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,37 @@ class Highlighter extends Component
8787

8888
export default Highlighter;
8989
```
90+
91+
### Marp
92+
93+
To use in [marp](https://marp.app)
94+
95+
First create file `engine.js`
96+
97+
```js
98+
const { Marp } = require('@marp-team/marp-core')
99+
const hljs = require('highlight.js')
100+
const iecst = require('highlightjs-structured-text')
101+
hljs.registerLanguage("ices", iecst)
102+
103+
module.exports = (opts) => {
104+
const marp = new Marp(opts)
105+
106+
marp.highlighter = (code, lang) => {
107+
if (lang) {
108+
return hljs.getLanguage(lang)
109+
? hljs.highlight(lang, code, true).value
110+
: ''
111+
}
112+
return hljs.highlightAuto(code).value
113+
}
114+
115+
return marp
116+
}
117+
```
118+
119+
And now when you build with CLI add engine parameter,
120+
121+
```bash
122+
npx marp --engine ./enjine.js ./slides.md
123+
```

0 commit comments

Comments
 (0)