Skip to content

how do I turn the Result object table into mdast or hast? #1218

Answered by ChristianMurphy
reypm asked this question in Q&A
Discussion options

You must be logged in to vote

Can you check really quick here https://codesandbox.io/s/remark-directive-forked-tjy5z6?file=/src/customPlugins/Shortcodes/UnorderedList.tsx ?? I am able to print out the toc but no links and I am not sure why because the headings has ids

The answer remains the same as before

If you are working with an MDAST tree (which it looks like you are) you can directly add/splice/replace the List into the content where you want it to go, and react-markdown will take care of the rest.

Don't run toHast on table.map, directly add table.map into the MDAST document.

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@ChristianMurphy
Comment options

@reypm
Comment options

@reypm
Comment options

@ChristianMurphy
Comment options

Answer selected by reypm
@reypm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants