Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bold italic in ReStructuredText

People also ask

How do I make my font bold and italic?

To make text bold, select and highlight the text first. Then hold down Ctrl (the control key) on the keyboard and press B on the keyboard. To make text italic, select and highlight the text first. Then hold down Ctrl (the control key) on the keyboard and then press the I on the keyboard.

How do you bold the Sphinx?

Bold Text. Use double asterisks to show text as bold, or strong.

How do I make text bold and italic in HTML?

HTML Formatting Elements<b> - Bold text. <strong> - Important text. <i> - Italic text.

What is bold italic font?

A. Bold/italic text is a common way to emphasize the text, such as highlight the text, citation, or people's speech, etc. There are three styles, include bold text, bold-italic text, and italic text. You can change the text style by selecting the options.


Although Markdown supports nesting bold and italic, reStructuredText does not (this is one of the rare cases where Markdown is more powerful, as there is no way to represent bold italics in reStructuredText).

https://gist.github.com/1855764


Recipe for HTML output.

my.rst:

.. role:: red
  :class: red

.. role:: bolditalic
  :class: bolditalic

:red:`WARNING` :bolditalic:`Don't be stupid!`

my.css:

.red { color: red; }
.bolditalic {
  font-weight: bold;
  font-style: italic;
}

Build by:

rst2html --strip-comments --halt warning --stylesheet=my.css my.rst my.html

In sphinx this is possible through custom roles: You make a style in css, and make a role pointing to that style. Here's an full working example of underlined text: sphinx-dev thread.

Edit:

Here's a good example: ReST strikethrough

Edit 2:

That sphinx-dev link is not available any more, so here's the gist, it very similar to the strikethrough link above:

CSS:

span.underlined {
  text-decoration: underline;
}

Register role in RST:

.. role:: underlined
   :class: underlined

to use it later as

:underlined:`test`

All this can be in a single RST document:

.. raw:: html

   <style type="text/css">
     span.underlined {
       text-decoration: underline;
     }
   </style>

.. role:: underlined
   :class: underlined

:underlined:`test`

Test it with::

rst2html5.py test01.rst test01.html