multi-paragraph replacements in reStructuredText or Sphinx
Is there a way to perform multi-paragraph replacements in reStructuredText / rST / reST (or at least in Sphinx)?
replace directive only allows single-paragraph replacements.
See also questions close to this topic
Sphinx autodoc can't import a module in the same directory
I have been using Sphinx for about a week now to document a package at work, and I've been using the autodoc extension to build the api for our code. This had worked fine for every module until today when two new modules were merged into our master branch. One of these modules,
psf_fit.pyimports the other module,
When trying to use autodoc to document
psf_fit.py, sphinx has no problem finding the module. However, the html build fails upon trying to import
blurreddata.py, even though they are in the same directory.
sys.pathhas been extended to the same directory since documentation began, and yet the problem persists. Why is autodoc failing on importing a module in the same directory as all the other modules it has no trouble importing?
The actual error message is,
C:\Users\lag649\PycharmProjects\PythonLevel1Services\docs\source\psf_fit.rst:14: WARNING: autodoc: failed to import class 'PointSpreadFunctionFit' from module 'psf_fit'; the following exception was raised: Traceback (most recent call last): File "C:\Users\lag649\AppData\Local\Continuum\anaconda3\lib\site-packages\sphinx\ext\autodoc.py", line 658, in import_object __import__(self.modname) File "C:\Users\lag649\PycharmProjects\PythonLevel1Services\osirisl1services\psf_fit.py", line 3, in <module> from osirisl1services.blurreddata import SAO2010, O3BDM ModuleNotFoundError: No module named 'osirisl1services.blurreddata'
python-sphinx extension, extra html files
I am working on extension for sphinx doc generator.
I would like to add some html, js, css and json files to html build of the doc.
They are not part of template and they should not be affected by anything in sphinx template. They are just viewer for files which I would like to add in downloads folder. (I also do not how.)
How to include extra html files in sphinx extension? JS/CSS can be added as described there https://docs.readthedocs.io/en/latest/guides/adding-custom-css.html but there is not a function for html.
How to get Sphinx working with Jython
Trying to compile sphinx into java code using jython. I was able to install sphinx on the installed jython, but when I run the sphinx quickstart program I get:
C:\jython2.7.0\bin>sphinx-quickstart.exe Traceback (most recent call last): File "C:\jython2.7.0\Lib\runpy.py", line 161, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\jython2.7.0\Lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\jython2.7.0\bin\sphinx-quickstart.exe\__main__.py", line 5, in <module> File "C:\jython2.7.0\Lib\site-packages\sphinx\cmd\quickstart.py", line 44, in <module> from sphinx.util.template import SphinxRenderer File "C:\jython2.7.0\Lib\site-packages\sphinx\util\template.py", line 17, in <module> from sphinx.jinja2glue import SphinxFileSystemLoader File "C:\jython2.7.0\Lib\site-packages\sphinx\jinja2glue.py", line 14, in <module> from typing import Any, Callable, Iterator, Tuple # NOQA File "C:\jython2.7.0\Lib\site-packages\typing.py", line 1302, in <module> class Generic(object): File "C:\jython2.7.0\Lib\site-packages\typing.py", line 1035, in __new__ if (isinstance(base, GenericMeta) and RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)
Any ideas on what this could be/mean?
Specify title attribute within rst
I would like to specify a descriptive "title" attribute that shows up in html when I convert my rst over but I don't know what syntax to use. Any help? Is this already implemented within rst?
How to find all supported python, reStructuredText fieldnames?
I'm trying to learn more than the common
:param myparam: Some descriptiondocumentation style common in many python modules, but haven't been able to identify a full list of supported fieldnames. From examples, I've gathered
def my_method(self, someval): """Returns one plus the given value :param someval: an integer on which to operate :whatelseisthere: """ return someval + 1
How to associate a new HTML snippet to a new reStructuredText directive ?
I'am new to Sphinx and the way it works, I'm trying to get familiar with the framework and understand how I can add my custom extensions.
Before I go any further, correct me if I'am wrong because I'm not sure if that's the right way to do it. But from what I can read and understand on the docs, it seems to be the way.
Ultimately, I'm trying to add a new directive to reStructuredText so then I can have a a custom bit of html / css generated for a specific Sphinx project.
I guess adding a new directive to reStructuredText is not the hardest thing to do so my question is more : How do I link my html snippet template to that specific directive ? So that whenever I use this directive, it generates that specific html code.
Looking forward to reading your replies !