0

I would like to include some ASCII art in a doc-string. However, even inside literal blocks, Sphinx seems to interpret \ as the escape sequence. Is there a reStructuredText environment in which the backslash character \ is evaluated literally? I would like to avoid using double backslashes as it then renders correctly in HTML but without rendering, the ASCII art in the raw doc-string is incorrect.

Example 1a: renders correctly to HTML, but incorrect without rendering

    The Sierpinski gasket graph (or Sierpinski triangle graph; [1]_,
    [2]_) is a self-similar or fractal graph defined recursively over
    the positive integers:

    1. $S_1$ is simply a triangle.

    2. $S_i$ is built by triplicating $S_{i-1}$ and arranging the
       three subgraphs in a triangle::

        |    S_1   -->     S_2
        |
        |     2             2
        |    / \\   -->     / \\
        |   0 - 1         0 - 1
        |                / \\ / \\
        |               3 - 4 - 5

Example 1b: renders incorrectly to HTML, but correct without rendering

    The Sierpinski gasket graph (or Sierpinski triangle graph; [1]_,
    [2]_) is a self-similar or fractal graph defined recursively over
    the positive integers:

    1. $S_1$ is simply a triangle.

    2. $S_i$ is built by triplicating $S_{i-1}$ and arranging the
       three subgraphs in a triangle::

        |    S_1   -->     S_2
        |
        |     2             2
        |    / \   -->     / \
        |   0 - 1         0 - 1
        |                / \ / \
        |               3 - 4 - 5

sinoroc
  • 18,409
  • 2
  • 39
  • 70
Paul Brodersen
  • 11,221
  • 21
  • 38

0 Answers0