Skip to content

How to get the content under a heading? #131

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

You must be logged in to vote

Welcome @ooker777! 👋
You may want to look at https://github.com/jake-low/remark-sectionize as a reference it does something similar to what I suspect you want to achieve.

I'm thinking of using unist-util-select, but it doesn't support heading selectors.

It is supported.
Headings are a node type, the third item on the list you linked to, is how to query by a node type (paragraph being a single example of a type, there are many, heading is another)
See https://github.com/syntax-tree/mdast?tab=readme-ov-file#contents for a full list of node types

Replies: 2 comments 6 replies

Comment options

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

@ooker777
Comment options

@ChristianMurphy
Comment options

@ooker777
Comment options

@ChristianMurphy
Comment options

Answer selected by ooker777
Comment options

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