yfm-docs
yfm-docs copied to clipboard
Auto toc
Currently, yfm builder requires it's users to create toc.yaml
and keep it up to date to build anything. That's not fun and often can be a great obstacle for usage (especially for casual usage).
It would be great to drop that requirement, replacing toc.yaml with "virtual" TOC that auto generated on the fly using the file structure of the project (without producing real toc.yaml
file in the process).
Page titles can be parsed from the first h1 tag (if it's present) or from the front-matter (if there is no h1 tag or user needs something custom).
This feature will make yfm great tool to quickly transform some boring folders with markdown texts into beautiful html documents, opening up opportunities to integrate with tools like Obsidian.md without additional overhead of composing toc.
This idea can be extended further in the future: for example, if I want to pin one page to the top of the sidebar but don't want to take the toll of keeping manual toc.yaml up to date just for that, maybe front-matter meta can be extended to include sidebar ordering priority too.
This is nice idea, but there is one problem... Help ti solve it please =)
How to order documents in virtual TOC? Alphabetical sort? Any wheight
field in document metadata? Any other idea?
Alphabetical sort? Any wheight field in document metadata? Any other idea?
maybe alphabetical by default with option to override it using weight attribute in doc meta?