-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: navigation icons for toc sidebar #67
Conversation
Icons can be invoked using 'nav-home', 'nav-up', 'nav-down', 'nav-prev' and 'nav-next'. It does require support for Awesomefont which can be triggered using the 'icons:font' attribute.
Some ideas for improvement:
|
Apparently it is ok to add css, as I see in the view-result processor. Also I'll try using the flexbox CSS for distributing the available icons evenly across the width of the sidebar. |
@mojavelinux Am I able to trigger the intelligent link handling in Asciidoctor from the postprocessor? Such that |
I did some refactoring on the extension, and I drew a lot of inspiration from the talk around PR #7
Discussion
TODO
|
Just found an additional explicit usecase when reading about GNU Make which lists navigational icons for each section, even though it is a single page. The links to |
Regarding manual placement, the manual placement of the table of contents using |
Nice work @nicorikken !
Indeed I think you should mimic TOC placement instead of using a block macro. I think it doesn't make any sense to have multiple navigation bars on one document ? |
Thanks! Still need to finish and polish it though. |
# render HTML | ||
content = "<div id=\"toc-nav-item\">" | ||
icon = "<i class=\"fa #{fa_name}\" aria-hidden=\"true\"></i>" | ||
if url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can use inline test and %()
for readability:
if url
link = %(<a href="#{url}" #{desc ? title="#{desc}" : nil}>#{icon}</a>)
end
Maybe we should set a default value for title
?
Yep but I think this should be another extension |
I did a quick review to better understand where you are heading. I'm just throwing ideas, feel free to do differently 😉 |
Thanks for all the comments, I'll take them into account when I do my next session of hacking on this code. |
@Mogztter Your comments triggered me to get coding this morning. Improvements I would still like to make:
|
I think this is extension is too complex for the lab, which is meant to serve as a reference for getting started with extensions. If someone is interested in the functionality this extension provides, I would encourage them to set this up as a separate extension project and publish it. |
Icons can be invoked using
nav-home
,nav-up
,nav-down
,nav-prev
andnav-next
. It does require support for Awesomefont which can be triggered using theicons:font
attribute.I'm eager to receive feedback on this, as I guess it can benefit from better checking and Ruby coding style in general. It basically does what it's supposed to do, but can probably be improved.
My main inspiration for the navigation icons was the Debian Maintainers guide