From 9e9c285711c0d3850d4980eb6bcd84f3f148c107 Mon Sep 17 00:00:00 2001 From: Valentin Vetter Date: Fri, 21 Apr 2023 14:56:54 +0200 Subject: [PATCH 1/7] Wrap example titles Signed-off-by: Valentin Vetter --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index c5ccc9f40..5b4cf7a85 100644 --- a/readme.md +++ b/readme.md @@ -56,6 +56,7 @@ You can use the many existing plugins or you can make your own. ## What is this? You can use plugins to turn markdown into HTML. + **In**: ```markdown @@ -69,6 +70,7 @@ You can use plugins to turn markdown into HTML. ``` You can use plugins to change markdown. + **In**: ```markdown From a6142627a526e9405a9b114eaeca8fade59e2a75 Mon Sep 17 00:00:00 2001 From: Valentin Vetter Date: Wed, 3 May 2023 10:48:51 +0200 Subject: [PATCH 2/7] Use sentences instead of raw labels Signed-off-by: Valentin Vetter --- readme.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index 5b4cf7a85..a610195a9 100644 --- a/readme.md +++ b/readme.md @@ -57,13 +57,13 @@ You can use the many existing plugins or you can make your own. You can use plugins to turn markdown into HTML. -**In**: +This markdown: ```markdown # Hello, *Mercury*! ``` -**Out**: +yields the following HTML: ```html

Hello, Mercury!

@@ -71,13 +71,13 @@ You can use plugins to turn markdown into HTML. You can use plugins to change markdown. -**In**: +This markdown: ```markdown # Hi, Saturn! ``` -**Plugin**: +with this plugin: ```js import {visit} from 'unist-util-visit' @@ -94,7 +94,7 @@ function myRemarkPluginToIncreaseHeadings() { } ``` -**Out**: +yields the following HTML: ```markdown ## Hi, Saturn! @@ -351,13 +351,14 @@ extensions. The syntax tree format used in remark is [mdast][]. It represents markdown constructs as JSON objects. -**In**: + +This markdown: ```markdown ## Hello *Pluto*! ``` -**Out**: +yields the following tree: ```js { From f5eae204b7009ff625e12b211fe2a32bd63b13a6 Mon Sep 17 00:00:00 2001 From: Valentin Vetter Date: Wed, 3 May 2023 14:50:36 +0200 Subject: [PATCH 3/7] Make examples more concrete Signed-off-by: Valentin Vetter --- readme.md | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/readme.md b/readme.md index a610195a9..6f67c7d2c 100644 --- a/readme.md +++ b/readme.md @@ -55,33 +55,63 @@ You can use the many existing plugins or you can make your own. ## What is this? -You can use plugins to turn markdown into HTML. - -This markdown: +With this project and a plugin, you can turn this markdown: ```markdown # Hello, *Mercury*! ``` -yields the following HTML: +…into the following HTML: ```html

Hello, Mercury!

``` -You can use plugins to change markdown. +
Show example code -This markdown: +```js +import {unified} from 'unified' +import remarkParse from 'remark-parse' +import remarkHtml from 'remark-html' + +const file = await unified() + .use(remarkParse) + .use(remarkHtml) + .process('# Hello, *Mercury*!') + +console.log(String(file)) // => '

Hello, Mercury!

' +``` + +
+ +With another plugin, you can turn this markdown: ```markdown # Hi, Saturn! ``` -with this plugin: +…into the following markdown: + +```markdown +## Hi, Saturn! +``` + +
Show example code ```js +import {unified} from 'unified' +import remarkParse from 'remark-parse' +import remarkStringify from 'remark-stringify' import {visit} from 'unist-util-visit' +const file = await unified() + .use(remarkParse) + .use(myRemarkPluginToIncreaseHeadings) + .use(remarkStringify) + .process('# Hi, Saturn!') + +console.log(String(file)) // => '## Hi, Saturn!' + /** @type {import('unified').Plugin<[], import('mdast').Root>} */ function myRemarkPluginToIncreaseHeadings() { return (tree) => { @@ -94,11 +124,7 @@ function myRemarkPluginToIncreaseHeadings() { } ``` -yields the following HTML: - -```markdown -## Hi, Saturn! -``` +
You can use remark for many different things. **[unified][]** is the core project that transforms content with ASTs. From 2c803baa9a4e108844f214cb7875376e9f8564ce Mon Sep 17 00:00:00 2001 From: Valentin Vetter Date: Fri, 5 May 2023 10:25:26 +0200 Subject: [PATCH 4/7] Allow HTML in Markdown in README Signed-off-by: Valentin Vetter --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 438897267..5c7318ca7 100644 --- a/package.json +++ b/package.json @@ -54,8 +54,10 @@ "prettier": true }, "remarkConfig": { - "plugins": [ - "preset-wooorm" + "remark-preset-wooorm", + [ + "remark-lint-no-html", + false ] }, "typeCoverage": { From 45dbf973cb696061744dbcaf4b278a2d85e224dc Mon Sep 17 00:00:00 2001 From: Valentin Vetter Date: Fri, 5 May 2023 10:27:54 +0200 Subject: [PATCH 5/7] Fix remarkConfig Signed-off-by: Valentin Vetter --- package.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5c7318ca7..888614391 100644 --- a/package.json +++ b/package.json @@ -54,10 +54,12 @@ "prettier": true }, "remarkConfig": { - "remark-preset-wooorm", - [ - "remark-lint-no-html", - false + "plugins": [ + "remark-preset-wooorm", + [ + "remark-lint-no-html", + false + ] ] }, "typeCoverage": { From 8d2933ef059f174383c5b2efa9281c809a7a0807 Mon Sep 17 00:00:00 2001 From: Valentin Vetter Date: Fri, 5 May 2023 10:28:22 +0200 Subject: [PATCH 6/7] Indent Signed-off-by: Valentin Vetter --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 888614391..29c929b9d 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "prettier": true }, "remarkConfig": { - "plugins": [ + "plugins": [ "remark-preset-wooorm", [ "remark-lint-no-html", From 40c77079c16b906dab45cc6e1d69c2dfb0ee08a2 Mon Sep 17 00:00:00 2001 From: Valentin Vetter Date: Fri, 5 May 2023 10:57:35 +0200 Subject: [PATCH 7/7] Try to fix build Signed-off-by: Valentin Vetter --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 29c929b9d..535f777c6 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ }, "remarkConfig": { "plugins": [ - "remark-preset-wooorm", + "preset-wooorm", [ "remark-lint-no-html", false