redjot is a project which provides unified-compatible
libraries for working with Djot. It allows to plug Djot files into
existing conversion pipelines. For example, redjot-rehype can be used
to convert djast (redjot version of Djot AST) into hast for further
processing with a large number of existing rehype plugins. Here's
a quick example:
import { unified } from "unified"
import redjotParse from "redjot-parse"
import redjotRehype from "redjot-rehype"
import rehypeStringify from "rehype-stringify"
const djot = `Hello from ^D^j~o~t`
const processor = unified()
.use(redjotParse)
.use(redjotRehype)
.use(rehypeStringify)
const html = await processor.process(djot)
console.log(String(html))
Which will print <p>Hello from <sup>D</sup>j<sub>o</sub>t</p> or
"Hello from Djot" rendered.
This monorepo contains the low-level djast packages, which operate on
the unified-compatible Djot AST:
djast: AST definitiondjast-util-from-djot: Djot parserdjast-util-to-hast: Conversion from
djast to hastAnd the high-level redjot packages for the unified processor API:
redjot-parse: wraps djast-util-from-djotredjot-rehype: wraps djast-util-to-hastredjot-metadata: parses embedded JSON
front matter