Skip to content
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

how to set href be the id of section? #66

Open
ShawSpring opened this issue Jun 23, 2024 · 3 comments
Open

how to set href be the id of section? #66

ShawSpring opened this issue Jun 23, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@ShawSpring
Copy link

ShawSpring commented Jun 23, 2024

by default, headings is the target of the anchor, but sections is better when headings blocked by fixed Navigation Bar。
so, please provide an option to set the href

@jrson83
Copy link
Owner

jrson83 commented Jun 25, 2024

by default, headings is the target of the anchor, but sections is better when headings blocked by fixed Navigation Bar。 so, please provide an option to set the href

Do you mean like so? This is currently not possible, but I will implement the feature if required.

<section id="heading-21-section">
  <h2 id="heading-21" role="presentation">
-   <a href="#heading-21" class="heading-anchor">
+   <a href="#heading-21-section" class="heading-anchor">
      <button type="button" class="heading-anchor__btn">#</button>
    </a>
    <span role="heading" aria-level="2">Heading 2.1</span>
  </h2>
  <p>Paragraph 1</p>
</section>

@jrson83 jrson83 added the enhancement New feature or request label Jun 25, 2024
@ShawSpring
Copy link
Author

yes.
but the href attribute points to section makes no difference, because there is no padding between section and heading.
If users need to add extra css, this feature might as well be implemented by users

@jrson83
Copy link
Owner

jrson83 commented Jun 25, 2024

yes.
but the href attribute points to section makes no difference, because there is no padding between section and heading.
If users need to add extra css, this feature might as well be implemented by users

How about the possibility of defining a value for the href attribute like so:

# Heading 2.1 [some-custom-anchor]
<section id="heading-21-section">
  <h2 id="heading-21" role="presentation">
-   <a href="#heading-21" class="heading-anchor">
+   <a href="#some-custom-anchor" class="heading-anchor">
      <button type="button" class="heading-anchor__btn">#</button>
    </a>
    <span role="heading" aria-level="2">Heading 2.1</span>
  </h2>
  <p>Paragraph 1</p>
</section>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants