add more to the readme
This commit is contained in:
parent
4d8e83a74a
commit
0763472b18
1 changed files with 35 additions and 0 deletions
35
README.md
35
README.md
|
@ -1,5 +1,40 @@
|
||||||
# remark-agda
|
# remark-agda
|
||||||
|
|
||||||
|
This is a plugin that processes Literate Agda files that are written in Markdown,
|
||||||
|
and replaces it with the HTML directly. This is useful for blogs where you want
|
||||||
|
to do additional processing with remark, such as Katex or others.
|
||||||
|
|
||||||
|
- [remark](https://github.com/remarkjs/remark)
|
||||||
|
- [literate Agda](https://agda.readthedocs.io/en/latest/tools/literate-programming.html#literate-markdown-and-typst)
|
||||||
|
|
||||||
|
This plugin has been extracted from the source code of [my blog](https://mzhang.io).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```
|
||||||
|
npm i remark-agda
|
||||||
|
pnpm add remark-agda
|
||||||
|
bun add remark-agda
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const vfile = await read("/path/to/file.lagda.md");
|
||||||
|
await unified()
|
||||||
|
.use(remarkParse)
|
||||||
|
.use(remarkAgda, options)
|
||||||
|
.use(remarkRehype, { allowDangerousHtml: true })
|
||||||
|
.use(rehypeRaw)
|
||||||
|
.use(rehypeStringify)
|
||||||
|
.process(vfile);
|
||||||
|
```
|
||||||
|
|
||||||
|
Note:
|
||||||
|
|
||||||
|
- Since this returns raw HTML, we need the `allowDangerousHtml: true` flag to `remarkRehype`
|
||||||
|
_as well as_ the `rehypeRaw` plugin to convert back.
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
||||||
Author: Michael Zhang
|
Author: Michael Zhang
|
||||||
|
|
Loading…
Reference in a new issue