Skip to content

Is there a way to visit a tree one after the other like await? #114

Discussion options

You must be logged in to vote

thank you @ChristianMurphy @wooorm 🎉

i used unist-util-visit for toc & rehype-rewrite to put the toc inside html.

full code inside scripts/generate-toc.mjshttps://github.com/deadcoder0904/vivliostyle

scripts/generate-toc.mjs

/**
 * node imports
 */
import path from 'path'

/**
 * unified imports
 */
import { unified } from 'unified'
import { visit } from 'unist-util-visit'
import { read, write } from 'to-vfile'

/**
 * remark imports
 */
import remarkRehype from 'remark-rehype'
import remarkParse from 'remark-parse'

/**
 * rehype imports
 */
import rehypeDocument from 'rehype-document'
import rehypeStringify from 'rehype-stringify'
import rehypeRewrite from 'rehype-rewrite'
import reh…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by deadcoder0904
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