You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the .extension.header_ids method on ComrakOptions produces some very interesting Html that is difficult to target with css for styling if I only want to target a specific header by the specific id.
So when you turn on header_ids, it places an empty <a> tag inside the headers. So if I want to target the <h3> text in css by the id I have to use, something like below which uses the :has() psuedo-class; and this is not fully supported on all browsers, and requires the latest versions of Chromium
h3:has(>#eric-christensen) {
color: red;
}
It would be better if the id was just rendered on the header tag itself like:
The text was updated successfully, but these errors were encountered:
ericarthurc
changed the title
The header id option generates very difficult html to style
The header_ids option generates very difficult html to style
Dec 26, 2022
As it happens, I totally agree with you — it's very convoluted HTML. This extension moreorless exists solely to provide compatibility with GitHub's own generation of header IDs. Of course, they've continued to change their product, but it's still relatively close, if you ignore all the SVG:
I'd be happy to accept PRs that made the generated HTML easier to work with, like your suggestion, and perhaps relegate this output to a GitHub-compatibility mode — maybe even only enabling it when --gfm is specified, even.
Using the .extension.header_ids method on ComrakOptions produces some very interesting Html that is difficult to target with css for styling if I only want to target a specific header by the specific id.
The rust code:
The markdown:
### Eric Christensen
The HTML:
So when you turn on header_ids, it places an empty
<a>
tag inside the headers. So if I want to target the<h3>
text in css by theid
I have to use, something like below which uses the:has()
psuedo-class; and this is not fully supported on all browsers, and requires the latest versions of ChromiumIt would be better if the
id
was just rendered on the header tag itself like:The text was updated successfully, but these errors were encountered: