diff --git a/package.json b/package.json index 43889726..535f777c 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,11 @@ }, "remarkConfig": { "plugins": [ - "preset-wooorm" + "preset-wooorm", + [ + "remark-lint-no-html", + false + ] ] }, "typeCoverage": { diff --git a/readme.md b/readme.md index c5ccc9f4..6f67c7d2 100644 --- a/readme.md +++ b/readme.md @@ -55,31 +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. -**In**: +With this project and a plugin, you can turn this markdown: ```markdown # Hello, *Mercury*! ``` -**Out**: +…into the following HTML: ```html

Hello, Mercury!

``` -You can use plugins to change markdown. -**In**: +
Show example code + +```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! ``` -**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) => { @@ -92,11 +124,7 @@ function myRemarkPluginToIncreaseHeadings() { } ``` -**Out**: - -```markdown -## Hi, Saturn! -``` +
You can use remark for many different things. **[unified][]** is the core project that transforms content with ASTs. @@ -349,13 +377,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 {