Skip to content

How do I create a compiler? #159

Answered by wooorm
nicholas-wilcox asked this question in Q&A
Discussion options

You must be logged in to vote

Heya!

rebber is also somewhat what you’re looking for: https://github.com/zestedesavoir/zmarkdown/tree/master/packages/rebber.

whose output ends up in file.result.

Typically the return value of a compiler is a string, which will end up on file.value. Non-strings are set at file.result.

By using utilities such as unist-util-visit

unist-util-visit is more typically a utility used in transforms. It could be used in a compiler. But compilers more typically handle each node type and return a string value for them.

[...] as the only other compilers I am familiar with, remark-stringify and rehype-stringify, hand off control to their respective syntax-tree utility serializers.

I would also …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@nicholas-wilcox
Comment options

@wooorm
Comment options

@nicholas-wilcox
Comment options

@wooorm
Comment options

@ChristianMurphy
Comment options

Answer selected by nicholas-wilcox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants