tighten / gistlog

GistLog - simple, easy blogging based on GitHub gists
https://gistlog.co/
274 stars 44 forks source link

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

Open engineersamuel opened 4 years ago

engineersamuel commented 4 years ago

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 commented 4 years ago

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

mattstauffer commented 4 years ago

@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 commented 4 years ago

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.

engineersamuel commented 4 years ago

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!

mattstauffer commented 4 years ago

@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.