Open HugoGranstrom opened 3 years ago
Yes, I think it should be offered by nimib. Ideally directly in the markdown rendering (and links should have the link icon appearing on hover as in GitHub).
OK, great! 👍 Can open an issue later unless you beat me to it ;) On this topic, should Nimib have more of these basic building blocks built-in? For example nbList
which takes an openArray[string]
and produces the list. Things people would probably roll themselves either way basically.
Ideally directly in the markdown rendering
You mean directly in nim-markdown
?
Nope, go ahead on open that! Not sure what you mean by the list.
No, did not mean in Nim-markdown, if I remember correctly you can configure the way Nim-markdown works adding components, but the thing is I have not a clear idea on how to do that.
Also, to create a toc and put it in some place, you would need to do something when block is created (e.g. add a value in a toc
or refs
array inside the context).
Nope, go ahead on open that! Not sure what you mean by the list.
On my way!
Judging from the rest of your answer we didn't have the same ideas in our heads hehe. Your idea is to automagically turn all #
, ##
, etc into links behind the scene? My mind was at adding a nbTitle
template. The list would then be an nbList
that would work like this:
nbList(["First", "Second", "Third"])
# produces:
"""
- First
- Second
- Third
"""
But idk if that's something you would want to have built-in to Nimib or if it should belong in a separate package nimib-helpers
or just nimib/helpers
. Then one could do such things as handling TOCs and stuff inside the templates.
No, did not mean in Nim-markdown, if I remember correctly you can configure the way Nim-markdown works adding components, but the thing is I have not a clear idea on how to do that.
Interesting, didn't know that. :)
Similarly to the cheatsheet example in Nimib I think making all the headers linkable is a good idea. That would make it easier to direct people asking questions to specific sections among other things. It would also allow us to have TOCs on every page like in the cheatsheet example if we wanted to. The current implementation needs some work though, optimally the headers themself (or a symbol in front/after of them) should be clickable so one easily can copy the link.
@pietroppeter Do you think this is functionality that (optionally) should be offered by Nimib/NimiBook itself or should we roll our own version here?