Using Links in Headers #1406
Unanswered
greg-szrama
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on a Slate conversion for a large set of implementation guides and API Specs. I have this idea on how to accomplish it by using multiple root slate documents and linking them through the TOC. Clicking on the H1 header will load the appropriate document at the header selected so the TOC expands properly. The big problem I'm having is that I can include links in the headers and they appear in the TOC:
# [Contact Information](http://www.example.com#contact-information)
But the link gets formatted oddly. It's rendered in HTML as...
<a href="#contact-information" class="toc-h1 toc-link active" data-title="Contact Information"></a><a href="http://www.example.com#contact-information">Contact Information</a>
I'm still new to getting under the hood of Slate. I was hoping I could get pointers on where the markdown is converted. I see in layout.erb where the TOC is generated but I can't account for how this is generated. For example, I'd expect the links to be nested as such:
<a href="#contact-information" class="toc-h1 toc-link active" data-title="Contact Information"><a href="http://www.example.com#contact-information">Contact Information</a></a>
If nothing else, I'd like to add a simple conditional to add the appropriate classes to the second anchor (toc-h1 toc-link active). If I edit the elements in the browser it appears and functions as I'd expect. Any pointers on where I can go to tweak this?
Beta Was this translation helpful? Give feedback.
All reactions