@@ -55,31 +55,63 @@ You can use the many existing plugins or you can make your own.
5555
5656## What is this?
5757
58- You can use plugins to turn markdown into HTML.
59- ** In** :
58+ With this project and a plugin, you can turn this markdown:
6059
6160``` markdown
6261# Hello, *Mercury*!
6362```
6463
65- ** Out ** :
64+ …into the following HTML :
6665
6766``` html
6867<h1 >Hello, <em >Mercury</em >!</h1 >
6968```
7069
71- You can use plugins to change markdown.
72- ** In** :
70+ <details ><summary >Show example code</summary >
71+
72+ ``` js
73+ import {unified } from ' unified'
74+ import remarkParse from ' remark-parse'
75+ import remarkHtml from ' remark-html'
76+
77+ const file = await unified ()
78+ .use (remarkParse)
79+ .use (remarkHtml)
80+ .process (' # Hello, *Mercury*!' )
81+
82+ console .log (String (file)) // => '<h1>Hello, <em>Mercury</em>!</h1>'
83+ ```
84+
85+ </details >
86+
87+ With another plugin, you can turn this markdown:
7388
7489``` markdown
7590# Hi, Saturn!
7691```
7792
78- ** Plugin** :
93+ …into the following markdown:
94+
95+ ``` markdown
96+ ## Hi, Saturn!
97+ ```
98+
99+ <details ><summary >Show example code</summary >
79100
80101``` js
102+ import {unified } from ' unified'
103+ import remarkParse from ' remark-parse'
104+ import remarkStringify from ' remark-stringify'
81105import {visit } from ' unist-util-visit'
82106
107+ const file = await unified ()
108+ .use (remarkParse)
109+ .use (myRemarkPluginToIncreaseHeadings)
110+ .use (remarkStringify)
111+ .process (' # Hi, Saturn!' )
112+
113+ console .log (String (file)) // => '## Hi, Saturn!'
114+
83115/** @type {import('unified').Plugin<[], import('mdast').Root>} */
84116function myRemarkPluginToIncreaseHeadings () {
85117 return (tree ) => {
@@ -92,11 +124,7 @@ function myRemarkPluginToIncreaseHeadings() {
92124}
93125```
94126
95- ** Out** :
96-
97- ``` markdown
98- ## Hi, Saturn!
99- ```
127+ </details >
100128
101129You can use remark for many different things.
102130** [ unified] [ ] ** is the core project that transforms content with ASTs.
@@ -349,13 +377,14 @@ extensions.
349377
350378The syntax tree format used in remark is [ mdast] [ ] .
351379It represents markdown constructs as JSON objects.
352- ** In** :
380+
381+ This markdown:
353382
354383``` markdown
355384## Hello *Pluto*!
356385```
357386
358- ** Out ** :
387+ yields the following tree :
359388
360389``` js
361390{
0 commit comments