mkdocs / mkdocs-click

An MkDocs extension to generate documentation for Click command line applications
https://pypi.org/project/mkdocs-click
Apache License 2.0
109 stars 15 forks source link

Add level highlight left border / custom css #10

Open fernandascovino opened 3 years ago

fernandascovino commented 3 years ago

Hey! Thanks for the develop of mkdocs-click, it'll save me a lot of time on documentation 💚

One thing that I would like to suggest is to have a left border on commands description to better organize the docs. I use mkdocstrings for Python documentation that has div structure inside, and it can be easily personalised with a custom.css file (example on the image bellow).

It would be great to do the same here! :)

image

florimondmanca commented 3 years ago

Hey! Thanks for the develop of mkdocs-click, it'll save me a lot of time on documentation 💚

You're welcome! This was an initial stab at it that fit our own minimal requirements, so happy to discuss any possible enhancements. :-)

If I understand correctly, this is about wrapping sections that contain "Usage" and "Parameters" around a <div>, setting a mkdocs-click specific CSS class there, so that users are able to target that class in a custom CSS file to customize the styling? That sounds pretty sensible.

Right now the only thing that's blocking that is that mkdocs-click is implemented as a Markdown Preprocessor, which means it transforms Markdown lines into Markdown lines, and that result is fed into the HTML renderer further down the line.

So before implementing this, a pre-requisite might be to switch over to BlockProcessor, which works at the HTML element tree level directly. There's a good example of that style in mkautodoc: https://github.com/tomchristie/mkautodoc/blob/master/mkautodoc/extension.py

Not sure if/when we'll get around to that, but that's my analysis for now. Anyone who comes across this is of course very much welcome to take this off if that's something they're interested in. :-)