Questions tagged [docutils]

a general purpose document processing system written in Python.

Docutils is an open-source text processing system for processing plain text documentation into useful formats such as HTML, LaTeX, man-pages, open-document or XML. It includes the markup language.

The Docutils homepage may be found here.

180 questions
1
vote
2 answers

Parse and write RST using docutils

Are there any writers available that will output reStructuredText? I thought the "null" writer might be for this purpose but it produces no output. My use case is to parse an existing RST file, modify the document tree in Python (e.g. to…
geographika
  • 6,458
  • 4
  • 38
  • 56
1
vote
0 answers

docutils: get line number for nested nodes

When parsing a ReStructuredText snippet with docutils and walking the document node tree, most nodes don't supply their line number in the source text. Example: import io from pathlib import Path import docutils.frontend import docutils.nodes import…
hoefling
  • 59,418
  • 12
  • 147
  • 194
1
vote
0 answers

Why is nodes instances different between Environnement Collector and doctree-resolved?

I am trying to write a Sphinx extension and I noticed that the nodes instances parsed during the environnement collector are not the same instances later when the doctree is resolved. I really don't understand why. I would like to set new properties…
nowox
  • 25,978
  • 39
  • 143
  • 293
1
vote
2 answers

Convert reStructuredText to plain text programmatically in Python

Say I have some reStructuredText source in a string source = """ ============ Introduction ============ Hello world. .. code-block:: bash $ echo Greetings. """ import sys import docutils.nodes import docutils.parsers.rst import…
Hatshepsut
  • 5,962
  • 8
  • 44
  • 80
1
vote
1 answer

How to create proper heading levels with rst2html

I don't understand why: H1: document title ################## Sample H2 ********* Sample content. results in:

H1: document title

Sample…

pcav
  • 11
  • 1
1
vote
2 answers

Docutils: Does rst2html copy images?

Does rst2html copy image directories and image paths? I tried rst2odt and it copies the images. I failed to reach the same for rst2html. It's crazy. It is a tool for documentation and yet I am searching for hours to find a definitive answer to such…
Blcknx
  • 1,921
  • 1
  • 12
  • 38
1
vote
1 answer

Colons in restructuredText inline literal

How can I make an inline literal with a colon in restructuredText? I'm trying to document a Python function that returns a dictionary, e.g., something like: def function(...): """ ... Returns: A dictionary mapping ``{id: {role:…
goodmami
  • 962
  • 15
  • 26
1
vote
0 answers

Create autonomous TOC from a ReStructuredText Document

I am writing a blog in Django and I want to compose my posts with ReStructuredText. I am using django-markup to convert the text to HTML which works perfectly fine. Additionally, I want to create a table of content out of that text (my blog…
Yannic Hamann
  • 4,655
  • 32
  • 50
1
vote
0 answers

How to properly hyperlink class-based views in Django documentation generator?

Django documentation shows information on how to make link to the view, but not class-based view. When I do: """ Redirects to :view:`accounts.ProfileDetailView` """ It shows link with url to: /admin/doc/views/accounts.profiledetailview/, but…
1
vote
1 answer

How to generate documentation for a Class-based View?

In Django documentation there's a short info on how to document models, views and other files to make it easily available in the Django Admin. But it lacks info on how to do this for class-based views. Say I have simple DetailView: class…
1
vote
1 answer

Security portion marking with Sphinx/rst

How can I successfully security portion mark paragraphs using Sphinx/rst? (U) This is a portion marked heading ------------------------------------ (U) This is a portion marked sentence that renders not what I'd expect. (U) This too is portion…
Scott
  • 13
  • 3
1
vote
1 answer

Other options for PyInstaller console = False?

I am using PyInstaller to build an windows exe distributable package for a Kivy application where docutils.rst is being used. When setting console = False in the PyInstaller .spec file a virus is reported. When console = True, everything runs…
Bill Bridge
  • 821
  • 1
  • 9
  • 30
1
vote
1 answer

Define Latex packages in reST file

We used Docutils to produce reST document, and then make a TeX file via rst2latex. In the rst file, we have added a lot of LaTeX code like: .. raw:: latex ~\\ \rule{\textwidth}{1pt} ~\\ But I do not know where to add packages like…
Masood
  • 685
  • 2
  • 8
  • 16
1
vote
1 answer

assigning variable names/tags to asciidoc document so I can use those names in jinja template

I need a way to extract tags from an Asciidoc file and save them into a python dictionary. I generally write in Asciidoc but I do not know how I can create variable names in Asciidoc that I can extract as keys to create a python dictionary. I have…
krishnab
  • 9,270
  • 12
  • 66
  • 123
1
vote
0 answers

RST cross referencing not working in code highlighting

I use docutils in order to produce documents via rst file. In my document, I need to add and highlight some source code. Also I use cross referencing to make some keywords (section names) hyperlink to the respective section. So, simply append an…