docs: fix anchor links (#1845)

This commit is contained in:
Marvin Hagemeister
2023-10-04 10:07:09 +02:00
committed by GitHub
parent aca645996c
commit bc415f6d04
2 changed files with 17 additions and 1 deletions
+16
View File
@@ -43,6 +43,22 @@ ol.nested li:before {
list-style: numeric;
}
.markdown-body .md-anchor {
color: inherit;
text-decoration: none !important;
}
.markdown-body .md-anchor span {
color: var(--color-accent-fg);
display: inline-block;
margin-left: .25rem;
opacity: 0;
visibility: hidden;
}
.markdown-body .md-anchor:hover span {
opacity: 1;
visibility: visible;
}
.markdown-body .highlight {
border: 1px solid #eaeef1;
border-radius: .5rem;
+1 -1
View File
@@ -38,7 +38,7 @@ class DefaultRenderer extends Marked.Renderer {
slugger: Marked.Slugger,
): string {
const slug = slugger.slug(raw);
return `<h${level} id="${slug}"><a class="anchor" aria-hidden="true" tabindex="-1" href="#${slug}">#</a>${text}</h${level}>`;
return `<h${level} id="${slug}"><a class="md-anchor" tabindex="-1" href="#${slug}">${text}<span aria-hidden="true">#</span></a></h${level}>`;
}
link(href: string, title: string | null, text: string) {