Skip to content

Commit

Permalink
Update top-level await in readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 27, 2022
1 parent ee0970f commit 218948d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 59 deletions.
24 changes: 10 additions & 14 deletions packages/rehype-katex/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,16 @@ import rehypeKatex from 'rehype-katex'
import rehypeDocument from 'rehype-document'
import rehypeStringify from 'rehype-stringify'

main()

async function main() {
const file = await unified()
.use(rehypeParse, {fragment: true})
.use(rehypeKatex)
.use(rehypeDocument, {
css: 'https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css'
})
.use(rehypeStringify)
.process(await read('example.html'))

console.log(String(file))
}
const file = await unified()
.use(rehypeParse, {fragment: true})
.use(rehypeKatex)
.use(rehypeDocument, {
css: 'https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css'
})
.use(rehypeStringify)
.process(await read('example.html'))

console.log(String(file))
```

Now running `node example.js` yields:
Expand Down
16 changes: 6 additions & 10 deletions packages/rehype-mathjax/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,13 @@ import rehypeParse from 'rehype-parse'
import rehypeMathjax from 'rehype-mathjax'
import rehypeStringify from 'rehype-stringify'

main()

async function main() {
const file = await unified()
.use(rehypeParse, {fragment: true})
.use(rehypeMathjax)
.use(rehypeStringify)
.process(await read('example.html'))
const file = await unified()
.use(rehypeParse, {fragment: true})
.use(rehypeMathjax)
.use(rehypeStringify)
.process(await read('example.html'))

console.log(String(file))
}
console.log(String(file))
```

Now running `node example.js` yields:
Expand Down
22 changes: 9 additions & 13 deletions packages/remark-math/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,15 @@ import remarkRehype from 'remark-rehype'
import rehypeKatex from 'rehype-katex'
import rehypeStringify from 'rehype-stringify'

main()

async function main() {
const file = await unified()
.use(remarkParse)
.use(remarkMath)
.use(remarkRehype)
.use(rehypeKatex)
.use(rehypeStringify)
.process(await read('example.md'))

console.log(String(file))
}
const file = await unified()
.use(remarkParse)
.use(remarkMath)
.use(remarkRehype)
.use(rehypeKatex)
.use(rehypeStringify)
.process(await read('example.md'))

console.log(String(file))
```

Now running `node example.js` yields:
Expand Down
39 changes: 17 additions & 22 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,15 @@ import remarkRehype from 'remark-rehype'
import rehypeKatex from 'rehype-katex'
import rehypeStringify from 'rehype-stringify'

main()

async function main() {
const file = await unified()
.use(remarkParse)
.use(remarkMath)
.use(remarkRehype)
.use(rehypeKatex)
.use(rehypeStringify)
.process(await read('example.md'))

console.log(String(file))
}
const file = await unified()
.use(remarkParse)
.use(remarkMath)
.use(remarkRehype)
.use(rehypeKatex)
.use(rehypeStringify)
.process(await read('example.md'))

console.log(String(file))
```

Now running `node example.js` yields:
Expand Down Expand Up @@ -130,15 +126,14 @@ Take the above KaTeX example and change:
+import rehypeMathjax from 'rehype-mathjax'
import rehypeStringify from 'rehype-stringify'
main()
@@ -13,7 +13,7 @@ async function main() {
.use(remarkParse)
.use(remarkMath)
.use(remarkRehype)
- .use(rehypeKatex)
+ .use(rehypeMathjax)
.use(rehypeStringify)
.process(await read('example.md'))
@@ -13,7 +13,7 @@
.use(remarkParse)
.use(remarkMath)
.use(remarkRehype)
- .use(rehypeKatex)
+ .use(rehypeMathjax)
.use(rehypeStringify)
.process(await read('example.md'))
```
Now running `node example.js` yields:
Expand Down

0 comments on commit 218948d

Please sign in to comment.