Skip to content

Commit 2139e2e

Browse files
author
estrattonbailey
committed
Add options doc to README
1 parent 3126a10 commit 2139e2e

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,27 @@ console.log(html);
4242
// <em>this</em> is <strong>easy</strong> to <code>use</code>.
4343
```
4444

45+
### Options
46+
Snarkdown also accepts an optional `options` object.
47+
48+
#### `options.highlight`
49+
Highlight code blocks when parsed. Accepts a function with the signature `hightlight(code, language)`. Return a highlighted string using the library or your choice.
50+
```javascript
51+
import snarkdown from 'snarkdown'
52+
import prism from 'prismjs'
53+
54+
let md = `
55+
\`\`\`javascript
56+
let md = "I'm a code block";
57+
\`\`\`
58+
`
59+
let html = snarkdown(md, {
60+
highlight: (code, language) => {
61+
return prism.highlight(code, prism.languages[language])
62+
}
63+
});
64+
```
65+
4566

4667
## License
4768

0 commit comments

Comments
 (0)