While using the basic theme, I have noticed that Sphinx (v3.2.1) seems to be generating "Next/Previous topic" sections. Is there any simple way to remove those?
Add the html_sidebars option to your conf.py file and pick the elements that you want in the sidebar. This overrides the theme's default sidebar elements. You can also add custom HTML elements to the _templates directory and include them in the sidebar, as well as customize what the sidebar displays on different pages. See the Sphinx docs for more info on the sidebar elements Sphinx provides by default.
Obviously this differs between themes since not all of them include rellinks in the sidebar, but for the out-of-the-box theme this should remove the previous/next topic links and display on the TOC and search box.
html_sidebars = {
'**': ['globaltoc.html', 'searchbox.html']
}
Related
I'm using the readthedocs theme for a personal sphinx documentation project. Everything works fine except the display of the left frame of the content list: It display all level of section headings, without showing any hierarchy. How to let it show levels as in most readthedocs documentation project?
After click the + sign, it looks right:
This is how I mark the section title:
Apache
======
How to restart
--------------
This sounds like this bug: Toc not expanding.
If not, please include your version of Sphinx, where you build the docs, and whether what you do to build the docs satisfies the conditions of that issue.
Otherwise, there is no configurable option to expand all options in the for the RTD Sphinx theme. See https://sphinx-rtd-theme.readthedocs.io/en/latest/configuring.html#toc-options You will have to write custom JavaScript to make it so, and include the static asset with the theme. That homework is left to the questioner or a gracious answerer.
You could also file a feature request at https://github.com/rtfd/sphinx_rtd_theme/issues/new
This is the default behavior of sphinx. The section that you select expands on the left side bar. Else, it remains collapsed. https://docs.readthedocs.io/en/latest/versions.html this link also shows similar kind of behavior. To make it collapsible on clicking, you will require to update the theme.
I want to modify the "Format" dropdown for CKEditor within Mura, because I don't like the way Mura renames the headings. For example, an <h2> element is renamed to "Heading", and an <h3> element is renamed to "Heading 2". I get why they did this, because the <h1> is reserved for the page title, but it's confusing for content editors and accessibility.
I want to remove this renaming feature.
I believe the naming being used (like "Heading 1") is part of the CKEditor itself (reference).
As far as which HTML tag is actually used for those formats, Mura allows you to customize that. Look at the contentRenderer.cfc file under your theme's folder. Within that file they are setting variables that are used to customize the editor and page layouts. Specifically this section (reference):
// The following settings allow developers to change logical page structure.
// For example, some developers prefer H1 tags for their page titles,
// some prefer H2 tags - you can adjust this here:
this.headline='h2';
this.subHead1='h3';
this.subHead2='h4';
this.subHead3='h5';
this.subHead4='h6';
I'm not 100% sure but I think those settings are also used within the CKEditor in Mura.
I'm using the Algolia plugin for Magento2. I'm trying to style my instant search results page like the below site:
https://www.modaoperandi.com/search?categories%5B%5D=bags
In the above link, certain filters (like category and deliver) are in the sidebar, while other filters (like designer and color) are in the top bar above the results. Is there any way for me to split the Algolia filters up like this in the template?
It's doable, but the extension do not support it out of the box and it requires custom tweaks of the extension.
The container of facet filters is rendered in wrapper.phtml file. And then in instantsearch.js file each facet is rendered into a div appended to this container.
So what you may do is to tweak or write your own wrapper.phtml file, which will contain a new facet container for horizontal filters. And then update instantsearch.js file to place some widgets into this new container.
But be careful then with updating the extension as when you edit the extension's files directly, you will lose those changes on the version update of the extension.
Is there a simple way (i.e., without creating an entirely new theme) to customize Sphinx so that it generates HTML pages without the search box?
An alternative, which I discovered reading the alabaster theme documentation is to explicitly list which (if any sidebars) are desired in the conf.py file. For example, including this fragment in conf.py:
html_theme = 'alabaster'
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'searchbox.html',
]
}
produces the searchbox; removing searchbox.html from that list and then building produces the same page but without the box. (More information can be found at the Sphinx documentation for the build-configuration file.)
You can do it by customizing (or should I say disabling) the searchbox template.
In conf.py, add this line:
templates_path = ["templates"]
Create a folder called templates in your Sphinx project directory.
In that folder, add an empty file called searchbox.html. This overrides the default template file (located in sphinx/themes/basic where Sphinx is installed).
I'm generating html documentation in Sphinx.
How do I modify the sidebar for each of the html pages in my document so that they include the toctree? By default the toctree only seems to display in the master_doc page, and only in the main area instead of the sidebar.
Is there an easy way to do this? I'll be using readthedocs to host the generated documentation, so I would prefer to avoid the use of any third-party plugins, unless they are also available on readthedocs.
You can customize your html sidebar in conf.py.
The default html sidebar consists of 4 templates:
['localtoc.html', 'relations.html', 'sourcelink.html', 'searchbox.html']
In conf.py you could change localtoc.html to globaltoc.html like this:
html_sidebars = { '**': ['globaltoc.html', 'relations.html', 'sourcelink.html', 'searchbox.html'] }
Since this in the end this will be used in HTML files, this should work on ReadTheDocs.
Including the 'globaltoc.html' has a drawback in that it doesn't show both the global and local toc for the page you're viewing.
It appears that others were irked about this limitation and resulted in the subsequent development of an extension to support a full toc in the sidebar, checkout: https://pypi.python.org/pypi/sphinxcontrib-fulltoc
Nothing will appear in the "Navigation" section of the default Sphinx sidebar until you add the names of files that you want to scan for section headings to the toctree:: directive in your .rst file.
For example, if you want all the headings of your index.rst file to appear in the Navigation pane, write index (without the extension) in the toctree:: list like so:
My Level 1 Heading
==================
Glorious content.
My Level 2 Heading
------------------
More content
.. toctree::
:maxdepth: 2
:caption: Contents:
index
The crucial bit is adding index right there at the end. If you're like me, you start your projects with the auto-generated template from sphinx-quickstart, which (at time of writing) populates your .rst files with EMPTY toctrees.