Skip to content

Commit 715f88a

Browse files
authored
docs: add cli extension docs (#2632)
1 parent b5bdcf9 commit 715f88a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

docs/USING_ADVANCED.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,23 @@ markedWorker.onmessage = (e) => {
184184

185185
markedWorker.postMessage(markdownString);
186186
```
187+
<h2 id="cli-extensions">CLI Extensions</h2>
188+
189+
You can use extensions in the CLI by creating a new CLI that imports marked and the marked binary.
190+
191+
```js
192+
// file: myMarked
193+
#!/usr/bin/node
194+
195+
import { marked } from 'marked';
196+
import customHeadingId from 'marked-custom-heading-id';
197+
198+
marked.use(customHeadingId());
199+
200+
import 'marked/bin/marked';
201+
```
202+
203+
```sh
204+
$ ./myMarked -s "# heading {#custom-id}"
205+
<h1 id="custom-id">heading</h1>
206+
```

docs/_document.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ <h1>Marked Documentation</h1>
4343
<li><a href="/using_advanced#inline">Inline Markdown</a></li>
4444
<li><a href="/using_advanced#highlight">Highlighting</a></li>
4545
<li><a href="/using_advanced#workers">Workers</a></li>
46+
<li><a href="/using_advanced#cli-extensions">CLI Extensions</a></li>
4647
</ul>
4748
</li>
4849
<li>

0 commit comments

Comments
 (0)