Fix header links not working due to mismatching id

This commit is contained in:
Agatha Lovelace 2021-07-08 01:04:26 +03:00
parent 6122190ef8
commit e9ba6f5787
No known key found for this signature in database
GPG Key ID: 2DB18BA2E0A80BC3
2 changed files with 11 additions and 6 deletions

View File

@ -15,8 +15,13 @@ module.exports = config => {
html: true html: true
}; };
let headingOptions = {
prefixHeadingIds: false,
className: "heading-anchor"
};
config.setLibrary("md", config.setLibrary("md",
markdownIt(options).use(markdownItScrollable).use(markdownItHeadings)); markdownIt(options).use(markdownItScrollable).use(markdownItHeadings, headingOptions));
const paths = [ const paths = [
'main/assets', 'main/assets',

View File

@ -40,11 +40,11 @@ div.contents a::before {
margin-right: 0em; margin-right: 0em;
} }
a[id*="user-content-"]::before { a[class="heading-anchor"]::before {
display: none; display: none;
} }
a[id*="user-content-"] svg { a[class="heading-anchor"] svg {
fill: #e5adea; fill: #e5adea;
margin-right: 5px; margin-right: 5px;
margin-left: -21px; margin-left: -21px;
@ -52,7 +52,7 @@ a[id*="user-content-"] svg {
transition: opacity 0.2s ease-in-out; transition: opacity 0.2s ease-in-out;
} }
:is(h1, h2, h3, h4, h5, h6):hover a[id*="user-content-"] svg { :is(h1, h2, h3, h4, h5, h6):hover a[class="heading-anchor"] svg {
opacity: 80%; opacity: 80%;
transition: opacity 0.2s ease-in-out; transition: opacity 0.2s ease-in-out;
} }
@ -264,8 +264,8 @@ pre > code:not([class]) {
padding-right: 0.5em; padding-right: 0.5em;
} }
a[id*="user-content-"] { a[class="heading-anchor"] {
margin-left: 0; margin-left: 21px;
float: right; float: right;
} }
} }