Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a custom footer to Sphinx documentation? (reStructuredText)

If I have some documentation, like for example Galleria's documentation, how can I set it up so that when I run the make html command it will add a custom footer on to each page?

I saw that I could potentially use the latex preamble section of conf.py if I was outputting it to a pdf format.

Thanks!

like image 609
cwd Avatar asked Apr 07 '11 17:04

cwd


People also ask

What is RST Sphinx?

reStructuredText is the default plaintext markup language used by Sphinx. This section is a brief introduction to reStructuredText (reST) concepts and syntax, intended to provide authors with enough information to author documents productively.

Does Sphinx support markdown?

To support Markdown-based documentation, Sphinx can use MyST-Parser. MyST-Parser is a Docutils bridge to markdown-it-py, a Python package for parsing the CommonMark Markdown flavor.


1 Answers

You have to extend the default layout by providing an html file like this:

{% extends '!layout.html' %}  {% block footer %}         <!-- your html code here --> {% endblock %} 

Save this in a _templates/ subdirectory as layout.html and make sure to tell conf.py where to find this directory:

# Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] 

More information on templating can be found here: https://www.sphinx-doc.org/en/master/templating.html

like image 101
UncleZeiv Avatar answered Oct 01 '22 09:10

UncleZeiv