restructuredtext

How do I create a global role/roles in Sphinx?

走远了吗. 提交于 2019-12-17 15:44:22
问题 This is a followup of "ReST Strikethrough" ReST strikethrough but in a Sphinx rather than ReST context. My question is whether there is a central place in sphinx where to put a "role" directive or whether this directive really has to be repeated in every rst file within a sphinx docmentation. In more detail: It is easy to define custom CSS styles for inline text (see ReST Strikethrough as example) using a role directive: .. role:: custom :class: custom This is an :custom:`inline text`. which

How do I set up custom styles for reStructuredText, Sphinx, ReadTheDocs, etc.?

独自空忆成欢 提交于 2019-12-17 12:44:49
问题 I want to extend the theme used by Sphinx and ReadTheDocs with my own custom styles. What is the best way I can do this so that my changes will stick? 回答1: Assumptions Your RTD doc set has something like the following structure: (root path) (some other stuff not germane to this discussion) _static/ _templates/ conf.py You're also building locally using sphinx-build or sphinx-autobuild using the default theme, but your deployed server might use the sphinx-rtd-theme instead. Use Case: Hatnotes

How to add extra whitespace between section header and a paragraph

六眼飞鱼酱① 提交于 2019-12-17 10:56:32
问题 I want to have more space between the header and the paragraph and between the paragraphs. I doesn't want this to be a global setting but I want to use it where and when required. Appreciate any suggestions. 回答1: You can use vertical bars at the beginning of lines to produce blank lines in the output. Like this: Heading ------- | | Paragraph with text. 回答2: I just had this problem and as davidjb pointed out, using | gives you too much space on LaTeX output. This is how I solved it. Define the

ReST strikethrough

旧巷老猫 提交于 2019-12-17 10:19:35
问题 Is it possible to strike text through in Restructured Text? Something that for example renders as a <strike> tag when converted to HTML, like: ReSTructuredText 回答1: I checked the docs better, as suggested by Ville Säävuori, and I decided to add the strikethrough like this: .. role:: strike :class: strike In the document, this can be applied as follows: :strike:`This text is crossed out` Then in my css file I have an entry: .strike { text-decoration: line-through; } 回答2: There is at least

Substitution inside inline markup while escaping whitespace

梦想的初衷 提交于 2019-12-14 04:19:14
问题 Given the following reST document .. |bar| replace:: baz bolded? :strong:`\ |bar|\ ` bolded? **\ |bar|** .. This one errors out .. bolded? **\ |bar|\ ** How do I create a bolded, substituted value? I want bolded? baz Here's a link to the online editor to test it out: http://rst.ninjs.org/?n=f57ac95e1fe1643572b45d7ae8f8950c&theme=basic 回答1: As reStructuredText doesn't support nested inline markup, the only way to create a reference with styled text is to use substitutions with the "replace"

Private sections of text possible in RestructuredText files?

一笑奈何 提交于 2019-12-14 01:28:16
问题 I'm in the process of converting some of my company's documentation from .md to .rst to be displayed in ReadTheDocs.com In some of these documents there are Internal sections that are not intended for our customers' consumption. Is there a way to mark these sections such that Sphinx doesn't render it into HTML? 回答1: Use the ifconfig directive. In your docs: .. ifconfig:: internal This stuff is only included in the built docs for internal versions. In your conf.py 's setup function: def setup

Retaining inline code inside references in Sphinx

风流意气都作罢 提交于 2019-12-13 11:51:55
问题 In Sphinx, if I have the following heading declaration: .. _somestuff: ``this is code``, this is not! ============================== It renders, like this: this is code , this is not! Which is good, but, if I use the reference, e.g: Have a look at :ref:`somestuff` It loses the code formatting and renders like: Have a look at this is code, this is not! instead of: Have a look at this is code, this is not! Is it possible to retain the code formatting in the reference? And how would I go about

Why Eclipse Pydev uses @author in default template

爱⌒轻易说出口 提交于 2019-12-13 07:55:48
问题 I have been intrested for python documenting for a while but I can't figured out why @author is default sytnax in python templates. Why it isn't :author: (in restructuredtext style)? From what reason is used syntax with @ and not with : I though that restructuredtext is most common in python world. 回答1: The Epytext Markup language is what you're looking for. It is epydoc's language. It makes use of the @ prefix, with such words as param , type , return , raise , etc. 来源: https://stackoverflow

Use sphinx within a serverless model

人走茶凉 提交于 2019-12-13 03:25:31
问题 I am currently using sphinx to automatically generate my documentation site from ReStructuredText files within a bitbucket repo. This is of course all managed/hosted internally but I have been thinking more and more about whether I could switch this out for a more serverless model, using FaaS to generate the site and then a cloud based site hosting for the actual hosting (e.g S3 static site hosting). I was wondering whether it was possible to use sphinx in a programmatic way (e.g within a AWS

Different font size in restructuredtext

自古美人都是妖i 提交于 2019-12-12 19:17:17
问题 I have bigger fonts on all type of lists. What should I do to keep the same font size in lists as in my normal paragraphs? For now I get this Plain text Typical result (in normal font size) Bullet lists (in normal font size): - This is item 1 (in bigger font size) - This is item 2 (in bigger font size) 回答1: What Sphinx generates depends on the theme you use. The theme sphinxdoc generates the same font size in bullet lists and in normal text. Spinx defines the theme in conf.py in the base