Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • Peter Saffrey
    Participant

    Hi Aakash,

    Thanks for the plugin!

    We want to be able to “deep link” a specific heading within a page that has been generated by Git it Write. In your example pages, it looks like an id attribute is added to headings (e.g., <h3 id=”heading1″>Heading1</h3>) so that adding that ID as a link (e.g., http://example.com/page/#heading1) causes the link to take you straight to that heading.

    However, in our page, these IDs are not added. Is there some setting I need to ensure IDs are attached to my headings?

    Thanks,

    Peter

    Hi Peter,

    GIW uses parsedown extra extension.

    To add id and class attribute, you need to use {#myid} for id and {.my class} at the end of the sentence.

    Example,

    ## Heading 2 {#myheading2}

    Thanks,
    Aakash

    Peter Saffrey
    Participant

    Thanks Aakash,

    I think that adding that annotation into the markdown also causes it to appear in the rendered markdown output – is that right? Is there a way to get the IDs to appear in the heading tags, but not have extra output in the Markdown as viewed in Github?

    Thanks,

    Peter

    Hi Peter,

    I understand the requirement. But not all users would require that option.

    My suggestion would be to use an external plugin to add “ids” to heading so you can link to those.

    Add IDs to Header Tags

    Suggested Google search – https://www.google.com/search?q=wordpress+add+id+to+heading

    Hope this helps.

    Thanks,
    Aakash

    Peter Saffrey
    Participant

    Hi Aakash,

    Is this what you do for your documentation? Looking at the your example output here: https://www.aakashweb.com/docs/git-it-write/faq/, there are IDs attached to the headers already. I just wanted to try to reproduce what you are doing in the page I linked above, which seems like exactly what I need 🙂

    Thanks for your continued help,

    Peter

    Hi Peter,

    I have done the same. I came up with a custom solution like done by the plugin I shared.

    Below is the code I’m using.

    https://gist.github.com/vaakash/9ef63c22192316b81986a4d78192b39f

    Thanks,
    Aakash

    Peter Saffrey
    Participant

    This is really helpful, thanks so much for taking the time to explain this to me 🙂

    Cheers,

    Peter

    Thanks Peter. I’ll mark this topic as resolved.

    Feel free to rate and review the plugin – https://wordpress.org/support/plugin/git-it-write/reviews/#new-post . Your review helps the plugin.

    Thanks,
    Aakash

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘[ git it write ] Heading IDs are not being added for deep linking’ is closed to new replies.

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter