docs: add cli extension docs (#2632)
This commit is contained in:
parent
b5bdcf9e03
commit
715f88aa9a
@ -184,3 +184,23 @@ markedWorker.onmessage = (e) => {
|
||||
|
||||
markedWorker.postMessage(markdownString);
|
||||
```
|
||||
<h2 id="cli-extensions">CLI Extensions</h2>
|
||||
|
||||
You can use extensions in the CLI by creating a new CLI that imports marked and the marked binary.
|
||||
|
||||
```js
|
||||
// file: myMarked
|
||||
#!/usr/bin/node
|
||||
|
||||
import { marked } from 'marked';
|
||||
import customHeadingId from 'marked-custom-heading-id';
|
||||
|
||||
marked.use(customHeadingId());
|
||||
|
||||
import 'marked/bin/marked';
|
||||
```
|
||||
|
||||
```sh
|
||||
$ ./myMarked -s "# heading {#custom-id}"
|
||||
<h1 id="custom-id">heading</h1>
|
||||
```
|
||||
|
@ -43,6 +43,7 @@
|
||||
<li><a href="/using_advanced#inline">Inline Markdown</a></li>
|
||||
<li><a href="/using_advanced#highlight">Highlighting</a></li>
|
||||
<li><a href="/using_advanced#workers">Workers</a></li>
|
||||
<li><a href="/using_advanced#cli-extensions">CLI Extensions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user