88** [ remark] [ github-remark ] ** plugin to support the
99[ generic directives proposal] [ commonmark-directive-proposal ]
1010(` :cite[smith04] ` ,
11- ` ::youtube[Video of a cat in a box]{v=01ab2cd3efg} ` , and such).
11+ ` ::youtube[Video of a cat in a box]{v=01ab2cd3efg} ` ,
12+ and such).
1213
1314## Contents
1415
@@ -43,29 +44,36 @@ one syntax for arbitrary extensions in markdown.
4344
4445## When should I use this?
4546
46- Directives are one of the four ways to extend markdown: an arbitrary extension
47- syntax (see [ Extending markdown] [ github-micromark-extending-markdown ] in
48- micromark’s docs for the alternatives and more info).
49- This mechanism works well when you control the content: who authors it, what
50- tools handle it, and where it’s displayed.
47+ Directives are one of the four ways to extend markdown:
48+ an arbitrary extension syntax
49+ (see [ Extending markdown] [ github-micromark-extending-markdown ]
50+ in micromark’s docs for the alternatives and more info).
51+ This mechanism works well when you control the content:
52+ who authors it,
53+ what tools handle it,
54+ and where it’s displayed.
5155When authors can read a guide on how to embed a tweet but are not expected to
5256know the ins and outs of HTML or JavaScript.
53- Directives don’t work well if you don’t know who authors content, what tools
54- handle it, and where it ends up.
55- Example use cases are a docs website for a project or product, or blogging
56- tools and static site generators.
57+ Directives don’t work well if you don’t know who authors content,
58+ what tools handle it,
59+ and where it ends up.
60+ Example use cases are a docs website for a project or product,
61+ or blogging tools and static site generators.
5762
5863If you * just* want to turn markdown into HTML (with maybe a few extensions such
59- as this one), we recommend [ ` micromark ` ] [ github-micromark ] with
64+ as this one),
65+ we recommend [ ` micromark ` ] [ github-micromark ] with
6066[ ` micromark-extension-directive ` ] [ github-micromark-extension-directive ] instead.
61- If you don’t use plugins and want to access the syntax tree, you can use
67+ If you don’t use plugins and want to access the syntax tree,
68+ you can use
6269[ ` mdast-util-from-markdown ` ] [ github-mdast-util-from-markdown ] with
6370[ ` mdast-util-directive ` ] [ github-mdast-util-directive ] .
6471
6572## Install
6673
6774This package is [ ESM only] [ github-gist-esm ] .
68- In Node.js (version 16+), install with [ npm] [ npmjs-install ] :
75+ In Node.js (version 16+),
76+ install with [ npm] [ npmjs-install ] :
6977
7078``` sh
7179npm install remark-directive
@@ -181,7 +189,8 @@ Add support for generic directives.
181189
182190###### Parameters
183191
184- * ` options ` ([ ` Options ` ] [ api-options ] , optional)
192+ * ` options `
193+ ([ ` Options ` ] [ api-options ] , optional)
185194 — configuration
186195
187196###### Returns
@@ -302,7 +311,8 @@ function myRemarkPlugin() {
302311
303312### Example: Styled blocks
304313
305- > 👉 ** Note** : This is sometimes called admonitions, callouts, etc.
314+ > 👉 ** Note** :
315+ > this is sometimes called admonitions, callouts, etc.
306316
307317This example shows how directives can be used to style blocks.
308318It’s based on the example in Use above.
@@ -318,8 +328,8 @@ If `myRemarkPlugin` was replaced with this function:
318328import {h } from ' hastscript'
319329import {visit } from ' unist-util-visit'
320330
321- // This plugin is an example to turn `::note` into divs, passing arbitrary
322- // attributes.
331+ // This plugin is an example to turn `::note` into divs,
332+ // passing arbitrary attributes.
323333function myRemarkPlugin () {
324334 /**
325335 * @param {Root} tree
@@ -371,14 +381,15 @@ if you chose xxx, you should also use yyy somewhere…
371381
372382## Authoring
373383
374- When authoring markdown with directives, keep in mind that they don’t work in
375- most places.
384+ When authoring markdown with directives,
385+ keep in mind that they don’t work in most places.
376386On your own site it can be great!
377387
378388## HTML
379389
380390You can define how directives are turned into HTML.
381- If directives are not handled, they do not emit anything.
391+ If directives are not handled,
392+ they do not emit anything.
382393
383394## CSS
384395
@@ -399,8 +410,8 @@ See [*Syntax tree* in
399410This package is fully typed with [ TypeScript] [ ] .
400411It exports no additional options.
401412
402- If you’re working with the syntax tree, you can register the new node types
403- with ` @types/mdast ` by adding a reference:
413+ If you’re working with the syntax tree,
414+ you can register the new node types with ` @types/mdast ` by adding a reference:
404415
405416``` js
406417/**
@@ -430,9 +441,10 @@ function myRemarkPlugin() {
430441Projects maintained by the unified collective are compatible with maintained
431442versions of Node.js.
432443
433- When we cut a new major release, we drop support for unmaintained versions of
434- Node.
435- This means we try to keep the current release line, ` remark-directive@^3 ` ,
444+ When we cut a new major release,
445+ we drop support for unmaintained versions of Node.
446+ This means we try to keep the current release line,
447+ ` remark-directive@3 ` ,
436448compatible with Node.js 16.
437449
438450## Security
@@ -445,14 +457,16 @@ or user content so there are no openings for
445457## Related
446458
447459* [ ` remark-gfm ` ] ( https://github.com/remarkjs/remark-gfm )
448- — support GFM (autolink literals, footnotes, strikethrough, tables,
449- tasklists)
460+ — support GFM
461+ (autolink literals, footnotes, strikethrough, tables, tasklists)
450462* [ ` remark-frontmatter ` ] ( https://github.com/remarkjs/remark-frontmatter )
451- — support frontmatter (YAML, TOML, and more)
463+ — support frontmatter
464+ (YAML, TOML, and more)
452465* [ ` remark-math ` ] ( https://github.com/remarkjs/remark-math )
453466 — support math
454467* [ ` remark-mdx ` ] ( https://github.com/mdx-js/mdx/tree/main/packages/remark-mdx )
455- — support MDX (ESM, JSX, expressions)
468+ — support MDX
469+ (ESM, JSX, expressions)
456470
457471## Contribute
458472
@@ -463,8 +477,9 @@ for ways to get started.
463477See [ ` support.md ` ] [ health-support ] for ways to get help.
464478
465479This project has a [ code of conduct] [ health-coc ] .
466- By interacting with this repository, organization, or community you agree to
467- abide by its terms.
480+ By interacting with this repository,
481+ organization,
482+ or community you agree to abide by its terms.
468483
469484## License
470485
0 commit comments