Reputation: 6166
I'm trying to make colored boxes using Sphinx for Python.
For example, this website has a lot of gray div or boxes (not the Note ones): http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
I'm wondering how they manage to create thoses boxes since this website is also created using sphinx.
One thing I found, is that Sphinx has built in colored boxes as shown here: http://openalea.gforge.inria.fr/doc/openalea/doc/_build/html/source/sphinx/rest_syntax.html#colored-boxes-note-seealso-todo-and-warnings. Those boxes would work perfectly for me if they didn't have the words "Note:", "SeeAlso" or "Warning" in the beginning.
Any help is greatly appreciated.
Upvotes: 2
Views: 9445
Reputation: 47032
Things like notes, warnings, and such are called admonitions. Unfortunately, you can't create ones that don't have a title, as it's required by reStructuredText.
The other boxes on that page are from code blocks. Code blocks are run through the Pygments color syntax highlighter.
There are a couple of other ways to get what you want. You could embed raw HTML, but that's frowned upon. The other choice might be to write an extension to create a directive that gives you the functionality you need.
Upvotes: 11