How to create numbered lists in (#) style with Sphinx - python-sphinx

The RST documentation quoted by Sphinx as "The authoritative reStructuredText User Documentation" (see here) shows several styles for the formatting of numbered lists, among them the parenthesized style (see here):
(1) foo
(2) bla
However, Sphinx generates a style with dots from such RST source:
1. foo
2. bla
The Sphinx documentation only shows that dotted style (see here).
My question is: Is there any way to make Sphinx create the parenthesized style for the numbers?

* This is a bulleted list.
* It has two items, the second
item uses two lines.
1. This is a numbered list.
2. It has two items too.
#. This is a numbered list.
#. It has two items too.
See reStructuredText Primer in Sphinx documentation site.

Related

Left-align all math blocks in Sphinx HTML output

I have Sphinx documentation containing math blocks via the math directive. By default, they are centered in the HTML output. I want them all to appear aligned at the left, but with some indentation with respect to the surrounding text.
For example, if this is in index.rst
For :math:`|r| < 1`:
.. math::
\sum\limits_{k=0}^{\infty} r^k = \frac{1}{1-r}
Text in following paragraph put here to demonstrate that the math block
is in fact centered on the page.
and conf.py is completely empty, then running sphinx-build . output in the same folder produces the following HTML page as viewed in the browser:
I want that formula and all other math blocks left-aligned with something like 2 "em" indentation. This question asks how to left-align a single math block. I'm hoping there is a way to achieve the same effect throughout the documentation without changing each and every math directive in the reStructuredText source.
This answer applies to MathJax, the default mathematics renderer in HTML output.
The following setting in conf.py left-aligns all math directive content:
mathjax3_config = {'chtml': {'displayAlign': 'left'}}
Indentation can be customized with displayIndent:
mathjax3_config = {'chtml': {'displayAlign': 'left',
'displayIndent': '2em'}}
References:
https://www.sphinx-doc.org/en/master/usage/extensions/math.html#confval-mathjax3_config
https://docs.mathjax.org/en/v3.0-latest/options/output/index.html#options-common-to-all-output-processors

Why does Sphinx+MyST put spaces inside HTML tags in the generated output?

I'm new to MyST and Sphinx, so perhaps this has an obvious explanation, but it is not obvious to me. Whenever I use any construct in my Markdown source, such as bold facing or italics or even an html element such as <span>, the result in the formatted HTML output contains spaces inside the HTML tags. For example, an input such as
* **Barcode**: the barcode identifying the item
* **Title**: the title of the item.
* **Author**: the author of the item.
produces this:
Note the space before the :. Inspecting the HTML reveals that the bold-faced element contains unexpected space characters:
Note the spaces inside the <strong>...</strong>. Why is this happening? What am I doing wrong? More importantly, how do I make it stop?
I'm using Sphinx 3.4.3 with myst-parser 0.13.3. My conf.py defines extensions as 'myst_parser', 'sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', and 'sphinx.ext.napoleon'.

Write footnote in separate section

From all examples I can find, Asciidoc's footnote is written inline:
http://www.seinan-gu.ac.jp/~shito/asciidoctor/html_chunk/chap73.html
The first time you enter a footnote you want to reuse, give it a unique ID in the first position.
The next time you reference the footnote you only need to insert the ID in the square brackets
Though it allows referencing footnote by id, but the example only references inline footnote.
How to write a footnote elsewhere, and reference in the main body of text? My footnotes can sometimes be a few paragraphs, so inline makes less sense.
Currently, there is no facility to control footnote positioning. See: https://asciidoctor.org/docs/user-manual/#user-footnotes
If you can live without auto-numbering, you can simulate footnotes using standard Asciidoctor notation:
== A section
A bold statement<<myfootnote1,^[1]^>>
== Another section
== Footnotes
[horizontal]
[[myfootnote1]]^1^::
Express your opinion in a brave way.

Are there cases of editing HTML output by Aspose.Word with CKEditor?

I am in trouble with the event that the sentence edited in CKEditor are not output to Word as a result of inheriting attributes of “-aw-import:ignore”.
A tag with this attribute is a tag that conveys the attribute of the original word when converting from html to word, and it is not output as word as a meta tag.
If the sentence entered in CKEditor inherits the attributes, it will not be output as word by mistake.
Aspose.Words writes this "-aw-import:ignore" only when it needs to make certain elements visible in HTML that would otherwise be collapsed and hidden by web browsers e.g. empty paragraphs, space sequences, etc.
Currently we mark only the following elements with “-aw-import:ignore”:
Sequences of spaces and non-breaking spaces that are used to simulate
padding on native list item (<li>) elements.
Non-breaking spaces that are used to prevent empty paragraphs from collapsing.
However, note that this list is not fixed and we may add more cases to it in the future.
Also, please note that Aspose.Words write   instead of because is not defined in XML. And by default Aspose.Words generate XHTML documents (i.e. HTML documents that comply with XML rules).
I work with Aspose as Developer Evangelist.
Please find below list of custom styles that Aspose.Words uses to save extra information in output HTML and usually this information is used for Aspose.Words-HTML-Aspose.Words round-trip. We will add description of these entities in documentation as soon as possible.
-aw-comment-author
-aw-comment-datetime
-aw-comment-initial
-aw-comment-start
-aw-comment-end
-aw-footnote-type
-aw-footnote-numberstyle
-aw-footnote-startnumber
-aw-footnote-isauto
-aw-headerfooter-type
-aw-bookmark-start
-aw-bookmark-end
-aw-different-first-page
-aw-tabstop-align
-aw-tabstop-pos
-aw-tabstop-leader
-aw-field-code
-aw-wrap-type
-aw-left-pos
-aw-top-pos
-aw-rel-hpos
-aw-rel-vpos
-aw-revision-author
-aw-revision-datetime

How to go up a level once a sub-section has been added to the document?

I have a Restructured Text document which several hierarchical sections, such as:
Main title
##########
Text under the main title.
Sub-section
===========
Text under the sub-section.
This works great, I get the correct HTML formatting when I compile it using Sphinx.
My question is: how can I go up a hierarchy level so I can add more text after a few sub-sections?
For example:
Main title
##########
Text under the main title.
Sub-section
===========
Text under the sub-section.
In my CSS, sub-section is indented.
I want this paragraph to be rendered as part of the Main title section,
not the sub-section.
I'm basically looking for a way to go up a level in the hierarchy.
Is this possible?
Thanks!
It's not possible to go "up" the hierarchy without starting a new section at the level you desire. Document section structure doesn't work that way. Changes in section level must be preceded by corresponding section titles. Using indentation to signal a section-like structure should only be used in a limited local scope.
What you're describing isn't a subsection, it's a topic. Docutils has a directive for that:
.. topic:: title
Topic text.
May include multiple body elements (paragraphs, lists, etc.).
There is also a "sidebar" directive for a similar structure, but typically for a parallel topic that's off to the side. The "rubric" directive may also be of interest.
See http://docutils.sourceforge.net/docs/ref/rst/directives.html for details.

Resources