gistlog icon indicating copy to clipboard operation
gistlog copied to clipboard

Anchors aren't auto-generated for headers like in GitHub

Open engineersamuel opened this issue 5 years ago • 5 comments

It seems that anchors don't work once the md is viewed in gistlog. For example I just made my first blog post: https://gistlog.co/engineersamuel/858571689dc9af802a26b63b1e8a1b56 . The TLDR What worked anchor doesn't work. However if you open the gist @ https://gist.github.com/engineersamuel/858571689dc9af802a26b63b1e8a1b56 and click the What worked then the anchor works fine.

engineersamuel avatar Jan 15 '20 19:01 engineersamuel

Side note, I made this blog from GistPad in VSCode and it worked amazingly, gistlog is simple but fantastic, great work authors!

engineersamuel avatar Jan 15 '20 19:01 engineersamuel

@engineersamuel Thanks for catching this! I'll look into it right now!

So glad you're enjoying Gistlog and we're so glad it's such a good match with the great work put into GistPad!

mattstauffer avatar Jan 16 '20 18:01 mattstauffer

OK, so in order to do this, we'll have to build our own parser that auto-adds those IDs to the headers, like GitHub does.

That's gonna take time, if we choose to do it. In the interim, could you just add some HTML right below that header? <a id="what-worked">

I'll try to test it myself a bit later, but that's one possible option.

mattstauffer avatar Jan 16 '20 18:01 mattstauffer

Ok now this is interesting. I added that <a id="what-worked"></a> but either github or gistlog modified the actual link once rendered, inspecting in dev tools shows it, in the dom, as <a id="user-content-what-worked"></a> . Hence what I'm doing now is [What worked](#user-content-what-worked) and it works!

engineersamuel avatar Jan 16 '20 23:01 engineersamuel

@engineersamuel Yah, GitHub does that. I'm glad you were able to get a temporary fix! I'd still love to see if we can make this happen on our own, so I'll keep the issue open for now.

mattstauffer avatar Jan 17 '20 13:01 mattstauffer