-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract MDX headings #16
base: next
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome @shilman 👏
@@ -151,6 +153,17 @@ export const extractImports = (root: t.File) => { | |||
return varToImport; | |||
}; | |||
|
|||
export const getHeadings = (root: any) => { | |||
const headings = [] as string[]; | |||
['h1', 'h2', 'h3', 'h4'].forEach((tag) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be difficult to have options for that? People probably have different opinions about "what should be searchable" and maybe want something like
docs: {
includeInSearch: 'h1, h2'
}
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I'll implement it all end-to-end using this simple method and then see how disruptive it is to make it configurable
Issue: N/A
What Changed
Extract h1-h4 MDX headings for better search
How to test
See unit tests
Change Type
maintenance
documentation
patch
minor
major
📦 Published PR as canary version:
3.1.1--canary.16.129f63c.0
✨ Test out this PR locally via: