-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Suport secondary or third level heading if no top level title found #6
Comments
Do you mean something like the following? This would mean the plugin would search for level 1, 2, and 4 headers, but not 3, 5, or 6. It will use the first level 1 header if one is present. If not, it will use the first level 2 header found. If that’s not present either, it will use the first level 4 header found. await compile(content, {
rehypePlugins: [
[rehypeMdxTitle, { levels: [1, 2, 4] }]
]
}) By default it will only look for a level 1 header. |
Or perhaps the configuration should only define one level, which implies all levels up to the one specified. So a level of 4 would mean to look for header levels 1-4. |
@remcohaszing it should not be a config option, but a fallback logic.
This makes it more likely to return a title. |
I read your proposal as: This code yields ### Level 3
## Level 2
# Level 1 This code yields ### Level 3
## Level 2 IMO this is weird. Why not yield |
What if you find the first heading of the highest rank? @guoyunhe do you have an actual example of what your users do? |
Yield In my case, I made an internal doc tool to generate websites from markdown. When creating the site navigation menu, here are cases when no title are parsed. Some people prefer writting level 2 or level 3 headings, simply because they think level 1 headings is too big in font size... You cannot really control it. |
Released in version 3.1.0 🎉 |
In my cases, users may write some document without first level heading:
## Page Title ...
Can it be supported to parse the first heading? (even if not top level?)
The text was updated successfully, but these errors were encountered: