1010
1111[ ** remark** ] [ remark ] plugin to serialize Markdown as HTML.
1212
13- > ⚠️ This package essentially packs [ ` remark-rehype ` ] [ remark2rehype ] and
13+ > ⚠️ This package essentially packs [ ` remark-rehype ` ] [ remark-rehype ] and
1414> [ ` rehype-stringify ` ] [ rehype-stringify ] , and although it does support some
1515> customisation, it isn’t very pluggable.
1616> It’s probably smarter to use ` remark-rehype ` directly and benefit from the
1717> [ ** rehype** ] [ rehype ] ecosystem.
1818
19- ## Note!
20-
21- This plugin is ready for the new parser in remark
22- ([ ` remarkjs/remark#536 ` ] ( https://github.com/remarkjs/remark/pull/536 ) ).
23- The current and previous version of the plugin works with the current and
24- previous version of remark.
25-
2619## Install
2720
2821This package is [ ESM only] ( https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c ) :
@@ -91,6 +84,10 @@ Serialize Markdown as HTML.
9184All options except for ` sanitize ` and ` handlers ` are passed to
9285[ ` hast-util-to-html ` ] [ to-html ] .
9386
87+ The underlying tools allow much more customisation.
88+ It is recommended to replace this project with [ ` remark-rehype ` ] [ remark-rehype ]
89+ and [ ` rehype-stringify ` ] [ rehype-stringify ] ;
90+
9491###### ` options.handlers `
9592
9693Object mapping [ mdast] [ ] [ nodes] [ mdast-node ] to functions handling them.
@@ -110,7 +107,7 @@ How to sanitize the output (`Object` or `boolean`, default: `true`):
110107 [ ` hast-util-sanitize ` ] [ sanitize ] , dangerous HTML is dropped
111108
112109> Note that raw HTML in Markdown cannot be sanitized, so it’s removed.
113- > A schema can still be used to allow certain values from [ integrations ] [ ]
110+ > A schema can still be used to allow certain values from other plugins
114111> though.
115112> To support HTML in Markdown, use [ ` rehype-raw ` ] [ raw ] .
116113
@@ -129,60 +126,6 @@ remark()
129126 .processSync (/* … */ )
130127```
131128
132- ## Integrations
133-
134- ` remark-html ` works great with:
135-
136- * [ ` remark-autolink-headings ` ] ( https://github.com/ben-eb/remark-autolink-headings )
137- — Automatically add links to headings in Markdown
138- * [ ` remark-github ` ] ( https://github.com/remarkjs/remark-github )
139- — Generate references to GitHub issues, PRs, users, and more
140- * [ ` remark-highlight.js ` ] ( https://github.com/ben-eb/remark-highlight.js )
141- — Highlight code blocks
142- * [ ` remark-html-emoji-image ` ] ( https://github.com/jackycute/remark-html-emoji-image )
143- — Transform emoji unicodes into html images
144- * [ ` remark-html-katex ` ] ( https://github.com/remark/remark-math/blob/HEAD/packages/remark-html-katex/readme.md )
145- — Transform math to HTML with KaTeX
146- * [ ` remark-math ` ] ( https://github.com/remarkjs/remark-math )
147- — Math support for Markdown (inline and block)
148- * [ ` remark-midas ` ] ( https://github.com/ben-eb/remark-midas )
149- — Highlight CSS code with [ midas] ( https://github.com/ben-eb/midas )
150- * [ ` remark-toc ` ] ( https://github.com/remarkjs/remark-toc )
151- — Generate a Tables of Contents
152- * …and [ more] [ remark-plugins ]
153-
154- All [ ** mdast** nodes] [ mdast ] can be compiled to HTML.
155- Unknown ** mdast** nodes are compiled to ` div ` nodes if they have ` children ` or
156- ` text ` nodes if they have ` value ` .
157-
158- In addition, ** remark-html** can be told how to compile nodes through
159- three ` data ` properties ([ more information] [ to-hast ] ):
160-
161- * ` hName ` — Tag name to compile as
162- * ` hChildren ` — HTML content to add (instead of ` children ` and ` value ` ), in
163- [ ` hast ` ] [ hast ]
164- * ` hProperties ` — Map of properties to add
165-
166- For example, the following node:
167-
168- ``` js
169- {
170- type: ' emphasis' ,
171- data: {
172- hName: ' i' ,
173- hProperties: {className: ' foo' },
174- hChildren: [{type: ' text' , value: ' bar' }]
175- },
176- children: [{type: ' text' , value: ' baz' }]
177- }
178- ```
179-
180- …would yield:
181-
182- ``` markdown
183- <i class="foo">bar</i>
184- ```
185-
186129## Security
187130
188131Use of ` remark-html ` is * unsafe* by default and opens you up to a
@@ -248,9 +191,7 @@ abide by its terms.
248191
249192[ remark ] : https://github.com/remarkjs/remark
250193
251- [ remark-plugins ] : https://github.com/remarkjs/remark/blob/HEAD/doc/plugins.md#list-of-plugins
252-
253- [ remark2rehype ] : https://github.com/remarkjs/remark-rehype
194+ [ remark-rehype ] : https://github.com/remarkjs/remark-rehype
254195
255196[ rehype ] : https://github.com/rehypejs/rehype
256197
@@ -262,8 +203,6 @@ abide by its terms.
262203
263204[ mdast-node ] : https://github.com/syntax-tree/mdast#nodes
264205
265- [ hast ] : https://github.com/syntax-tree/hast
266-
267206[ to-html ] : https://github.com/syntax-tree/hast-util-to-html
268207
269208[ to-hast-handlers ] : https://github.com/syntax-tree/mdast-util-to-hast#optionshandlers
@@ -272,8 +211,4 @@ abide by its terms.
272211
273212[ github ] : https://github.com/syntax-tree/hast-util-sanitize#schema
274213
275- [ to-hast ] : https://github.com/syntax-tree/mdast-util-to-hast#note
276-
277- [ integrations ] : #integrations
278-
279214[ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
0 commit comments