Skip to content

Commit

Permalink
Refactor example
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Feb 3, 2025
1 parent 6275528 commit 093fed2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,19 @@ console.warn("Hello, " + name + "!")</code></pre>
…and our module `example.js` contains:

```js
import {rehype} from 'rehype'
import rehypeHighlight from 'rehype-highlight'
import rehypeParse from 'rehype-parse'
import rehypeStringify from 'rehype-stringify'
import {read} from 'to-vfile'
import {unified} from 'unified'

const file = await rehype()
.data('settings', {fragment: true})
const file = await read('example.html')

await unified()
.use(rehypeParse, {fragment: true})
.use(rehypeHighlight)
.process(await read('example.html'))
.use(rehypeStringify)
.process(file)

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

0 comments on commit 093fed2

Please sign in to comment.