rst-parser
rst-parser copied to clipboard
Expose main TOC to the layout's template
Hello,
one of the current task we're working on, is to provide some preview theme for the user. The theme which Sphinx was providing is Read the docs. Then, in order to build a nice main nav on the left, we would need the parser to expose the environment and / or (?) the main TOC to the template engine.
thanks :)
I don't quite understand what is desired here. @weaverryan can you chime in?
Yea, totally :). The goal is to allow people to build the Symfony docs, and get some rendered HTML that has a somewhat nice, realistic looking layout. It won't look like symfony.com, but it will look good enough - e.g. the final HTML would have a look similiar to https://sphinx-rtd-theme.readthedocs.io/en/latest/
To do that, we'll leverage themes: https://www.doctrine-project.org/projects/doctrine-rst-parser/en/latest/themes.html#themes
One of the things that the Sphinx themes can do (and the above is an example) is render the left menu table of contents. For example, here is the layout code from the above theme - this part is used to render the table of contents: https://github.com/rtfd/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html#L146-L164
I don't know much about Sphinx themes, but they look incredibly powerful, but complex. I'm not super motivated personally to try to meet "feature parity" or compatibility with their theming system. Instead, I'd prefer (just to have less work... and because we only need the theming to make something "decent" to look at while developing) to piece-by-piece figure out what variables we need to expose - taking Sphinx as inspiration.
Thoughts?
Ok, I think I understand now. I will make some enhancements to the theme functionality that should give you what you need.