Open icorbrey opened 2 weeks ago
A visual example of what's occurring, I'm writing a theme that differentiates each heading level with color and this is currently broken on MDX. Expected:
Actual:
Looks like the issue is upstream in https://github.com/wooorm/markdown-tm-language, should be an easy fix? H3 - H6 are already targeted in the TMLanguage file, just not assigned the right IDs
PR is in to hopefully fix this at https://github.com/wooorm/markdown-tm-language/pull/12
Hi!
Have you tested that your changes work with GitHub and some common/default VS Code themes?
Often, themes don’t support all scopes.
I think for GH this will be fine. That’s just looking at markup.heading
.
It might be interesting to know of this breaks any things. But even if this breaks a theme, this change makes sense IMO. Themes can adapt.
Is there a reason H3 - H6 were assigned H2 scopes?
I don’t remember. Hence the question.
It might be interesting to know of this breaks any things. But even if this breaks a theme, this change makes sense IMO. Themes can adapt.
GH doesn’t. There are several workarounds for GH. That’s the most important.
As for VS Code defaults: that’s chicken and egg. At this point this grammar is not too often used. So it is less likely that VS Code changes things. But theoretically I’d agree with you.
Also: this can be used in many places. TextMate. Sublime. Anywhere. Some compatibility between existing things is nice. We can’t expect every software to change.
Okay so after looking a fair amount I can't really see anything that is explicitly relying on H3 - H6 all having H2 scope, but some that already rely on headings having the correct scope that get broken in MDX. For example, Catppuccin Frappe from Catppuccin for VSCode
Searching for files not using deeper headings shows that pretty much repo that references H2 scopes and not any deeper ones is just bundling https://github.com/wooorm/markdown-tm-language instead of doing something meaningful with it.
Now I can't speak on GitHub, as I don't know where I'd even begin to look for their implementations let alone if they're source available, but from my surface level lookover I can't see anywhere that they'd be relying on this behavior. They seem to not care what level a heading is wherever I look.
For GH, see my earlier comment https://github.com/mdx-js/mdx-analyzer/issues/483#issuecomment-2467876802. As for source, see e.g. https://github.com/primer/github-syntax-dark/blob/master/lib/github-dark.css.
Thanks for checking!
Ah, I think I missed that comment. Thanks!
Initial checklist
Affected packages and versions
v1.8.11
Link to runnable example
No response
Steps to reproduce
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6