Giter Site home page Giter Site logo

Comments (3)

wooorm avatar wooorm commented on June 5, 2024

there's no way to manually specify a header's ID.

This plugin allows existing IDs:

if (headingRank(node) && node.properties && !hasProperty(node, 'id')) {
. It generates IDs for any heading that doesn’t have one. You can run any plugin before (or after) to use different IDs.

if I want to update a header's text, I must then go and update many of the links into that section.

This sounds like a different problem than your solution? With {#id}s, when you change them, you must also update all links?

we can support the same Title {#id} syntax as gatsby-remark-autolink-headers and others

I’m not a giant fan of this syntax, as it interferes with MDX 2 expressions, and isn’t supported by CommonMark or GitHub (in fact, it breaks linking on GH). Why do you want manual IDs? How often do you use them?
You could implement them as a syntax extension as well: https://github.com/micromark/micromark#case-variables.

from rehype-slug.

crutchcorn avatar crutchcorn commented on June 5, 2024

Hmm that's true. I may just take that logic and export elsewhere in a different rehype plugin

This sounds like a different problem than your solution? With {#id}s, when you change them, you must also update all links?

This is true, but with an important caveat: I tend to have an alright grasp of the section when I update the headers' text, but not a perfect grasp on what the headed section should be called in terms of a heading tag. Because of this, the manual IDs tend to help rather frequently with understanding the sections, being able to change the headings without having to change the section links. (because for each heading I add a link to the blog that I tend to link out for specific purposes)

You could implement them as a syntax extension as well: https://github.com/micromark/micromark#case-variables.

I admittedly missed this. Seems like the better implementation route to go towards. The Unified ecosystem is so big - it's awesome!

from rehype-slug.

wooorm avatar wooorm commented on June 5, 2024

This problem is something several people touch on, so I’d like to be involved in finding a proper solution.
I don’t think that’s here. But do ping me wherever you’re having the discussion!

from rehype-slug.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.