-
AuthorPosts
-
January 30, 2024 at 4:32 pm #14134Peter SaffreyParticipant
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
January 31, 2024 at 11:30 pm #14152Aakash ChakravarthyKeymasterHi 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,
AakashFebruary 5, 2024 at 3:20 pm #14212Peter SaffreyParticipantThanks 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
February 6, 2024 at 11:11 pm #14231Aakash ChakravarthyKeymasterHi 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.
Suggested Google search – https://www.google.com/search?q=wordpress+add+id+to+heading
Hope this helps.
Thanks,
AakashFebruary 7, 2024 at 8:05 pm #14242Peter SaffreyParticipantHi 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
February 7, 2024 at 11:48 pm #14245Aakash ChakravarthyKeymasterHi 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,
AakashFebruary 8, 2024 at 3:07 pm #14254Peter SaffreyParticipantThis is really helpful, thanks so much for taking the time to explain this to me 🙂
Cheers,
Peter
February 9, 2024 at 12:04 am #14261Aakash ChakravarthyKeymasterThanks 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 -
AuthorPosts
- You must be logged in to reply to this topic.