Debian Codegraph @

docs/dev/todo.rst

raw
1 .. include:: ../header.rst
2
3 ======================
4 Docutils_ To Do List
5 ======================
6
7 :Author: David Goodger (with input from many); open to all Docutils
8 developers
9 :Contact: [email protected]
10 :Date: $Date: 2025-10-06 14:29:47 +0200 (Mo, 06. Okt 2025) $
11 :Revision: $Revision: 10253 $
12 :Copyright: This document has been placed in the public domain.
13
14 .. _Docutils: https://docutils.sourceforge.io/
15
16 .. contents::
17
18
19 Priority items are marked with "@" symbols. The more @s, the higher
20 the priority. Items in question form (containing "?") are ideas which
21 require more thought and debate; they are potential to-do's.
22
23 Many of these items are awaiting champions. If you see something
24 you'd like to tackle, please do!
25 Please see also the Bugs_ document for a list of bugs in Docutils.
26
27 .. _bugs: ../../BUGS.html
28
29
30 Minimum Requirements for Python Standard Library Candidacy
31 ==========================================================
32
33 Below are action items that must be added and issues that must be
34 addressed before Docutils can be considered suitable to be proposed
35 for inclusion in the Python standard library.
36
37 Many of these are now handled by Sphinx_
38
39 * Support for `document splitting`_. May require some major code
40 rework.
41
42 * Support for subdocuments (see `large documents`_).
43
44 * `Object numbering and object references`_.
45
46 * `Nested inline markup`_.
47
48 * `Python Source Reader`_.
49
50 * The HTML writer needs to be rewritten (or a second HTML writer
51 added) to allow for custom classes, and for arbitrary splitting
52 (stack-based?).
53
54 * Documentation_ of the architecture. Other docs too.
55
56 * Plugin support.
57
58 * Suitability for `Python module documentation
59 <https://docutils.sourceforge.io/sandbox/README.html#documenting-python>`_.
60
61 .. _Sphinx: http://www.sphinx-doc.org/
62
63 Repository
64 ==========
65
66 Move to a Git repository.
67
68 See `feature requests #58`__
69 (with pointers to Sphinx issues and discussion).
70
71 __ https://sourceforge.net/p/docutils/feature-requests/58/
72
73 * From a `post by David Goodger`__
74
75 An absolute requirement, for me, is that such a change be complete.
76 We can't lose any data or have to refer to the old system as an
77 "archive". So all the SVN history, all branches, and the full sandbox
78 need to be converted at the same time.
79
80 __ https://sourceforge.net/p/docutils/mailman/message/31878077/
81
82 Convert with reposurgeon_?
83
84 If you are doing a full import rather than gatewaying, reposurgeon is
85 probably what you want. It has been tested against a lot of large, old,
86 nasty repositories and is thus known to be robust in the presence of
87 repository malformations (a property regularly checked by a test suite
88 that is a rogue's gallery of Subversion botches).
89
90 -- `Git Wiki`__
91
92 The comprehensive `Reposurgeon documentation`_ comes with
93 `a guide to repository conversion`__
94 as well as info about `reading Subversion repositories`__.
95 Converting from an SVN dump file is faster than from a checkout.
96
97 .. _reposurgeon: http://www.catb.org/esr/reposurgeon/
98 .. _reposurgeon documentation:
99 http://www.catb.org/esr/reposurgeon/repository-editing.html
100 __ https://git.wiki.kernel.org/index.php/
101 Interfaces,_frontends,_and_tools#Subversion
102 __ http://www.catb.org/esr/reposurgeon/repository-editing.html#conversion
103 __ http://www.catb.org/esr/reposurgeon/repository-editing.html
104 #_reading_subversion_repositories
105
106
107 Adam Turner wrote a conversion Makefile and ``.lift`` scripts that
108 downloads the repo from SF with rsync, converts it to a SVN mirror and
109 finally to Git, splitting sandbox, prest, and web from docutils.
110
111
112 Sourceforge supports multiple Git repositories per project, so we can
113 switch the version control system independent of the decision on an
114 eventual switch of the host
115 (cf. https://sourceforge.net/p/forge/documentation/Git/).
116
117
118 General
119 =======
120
121 Miscellaneous
122 -------------
123
124 * Improve handling on Windows:
125
126 - Get graphical installer.
127 - Make rst2html.py an .exe file using py2exe.
128 (Is this still required after we have "console scripts" entry points?
129 GM 2023-06-25)
130
131 * .. _GUI:
132
133 The user interface is very difficult to use for most Windows users;
134 you can't really expect them to use the command line. We need some
135 kind of GUI that can launch ``rst2html``, and save the HTML output to
136 a file, and launch a browser. What's important is that we get
137 settings to work with the GUI. So we need some way to dynamically
138 generate a list of settings for the GUI. The current settings_spec
139 for OptionParser doesn't seem to be usable for this for the
140 following reasons:
141
142 - It's biased toward the command line -- there are *two* options for
143 one boolean setting.
144
145 - You cannot have both a one-line description and a longer
146 description for tooltips/help-texts.
147
148 - It doesn't provide hints for the input type. You cannot easily
149 infer the type of a setting from its validator, because any
150 component can add new validators. In fact, it may be necessary to
151 have both a hint about the input type (e.g. string) and a
152 validator (valid ID), or it may be necessary to have a different
153 set of choices for the CLI (1, INFO, 2, ...) and for the GUI
154 (INFO, WARNING, ...).
155
156 - It's coupled to the OptionParser. We want to be able to change
157 the underlying system without breaking everything.
158
159 - It's a bunch of primitive structures. We want an extensible (thus
160 object-oriented) interface.
161
162 So we probably need to create a class for storing all the settings,
163 and auto-generate the OptionParser data from that.
164
165 I talked to Stephan Deibel about getting Docutils integrated into
166 Wing IDE. He said it's possible, and he'd be willing to help.
167 There's a scripting interface to Wing, which we'd use. We can
168 dynamically generate a list of preferences and not worry too much
169 about the rendering (from what I understood); Wing's whole GUI is
170 dynamic anyway. The interface could be made usable for other GUIs.
171 For example, we could try to get option support for DocFactory. //
172 FW
173
174 * Allow different report levels for STDERR and system_messages inside
175 the document?
176
177 * Change the docutils-update script (in sandbox/infrastructure), to
178 support arbitrary branch snapshots.
179
180 * Move some general-interest sandboxes out of individuals'
181 directories, into subprojects?
182
183 * Add option for file (and URL) access restriction to make Docutils
184 usable in Wikis and similar applications.
185
186 2005-03-21: added ``file_insertion_enabled`` & ``raw_enabled``
187 settings. These partially solve the problem, allowing or disabling
188 **all** file accesses, but not limited access.
189
190 * Configuration_ file handling needs discussion:
191
192 - There should be some error checking on the contents of config
193 files. How much checking should be done? How loudly should
194 Docutils complain if it encounters an error/problem?
195
196 - Docutils doesn't complain when it doesn't find a configuration
197 file supplied with the ``--config`` option. Should it? (If yes,
198 error or warning?)
199
200 * Internationalization:
201
202 - I18n needs refactoring, the language dictionaries are difficult to
203 maintain. Maybe have a look at gettext or similar tools.
204
205 (This would make a nice Google Summer of Code project)
206
207 - Language modules: in accented languages it may be useful to have
208 both accented and unaccented entries in the
209 ``bibliographic_fields`` mapping for versatility.
210
211 - Add a "--strict-language" option & setting: no English fallback
212 for language-dependent features.
213
214 Make this the default for output (as opposed to input)?
215 Throw an error with a helpful message, e.g.
216
217 Default "contents" title for language %s missing, please specify
218 an explicit title.
219
220 or
221
222 "attention" title for language %s missing, please use a generic
223 admonition with explicit title.
224
225 - Add internationalization to _`footer boilerplate text` (resulting
226 from "--generator", "--source-link", and "--date" etc.), allowing
227 translations.
228
229
230 * In ``docutils.readers.get_reader_class`` (& ``parsers`` &
231 ``writers`` too), should we be importing "standalone" or
232 "docutils.readers.standalone"? (This would avoid importing
233 top-level modules if the module name is not in docutils/readers.
234 Potential nastiness.)
235
236 * Perhaps store a _`name-to-id mapping file`? This could be stored
237 permanently, read by subsequent processing runs, and updated with
238 new entries. ("Persistent ID mapping"?)
239
240 * Perhaps the ``Component.supports`` method should deal with
241 individual features ("meta" etc.) instead of formats ("html" etc.)?
242 Currently, it is not used at all.
243
244 Do we need it at all? Or rather let the writers just ignore some
245 nodes (like we already do for "class" values)?
246
247 * Think about _`large documents` made up of multiple subdocument
248 files. Issues: continuity (`persistent sequences`_ above),
249 cross-references (`name-to-id mapping file`_ above and `targets in
250 other documents`_ below), splitting (`document splitting`_ below).
251
252 When writing a book, the author probably wants to split it up into
253 files, perhaps one per chapter (but perhaps even more detailed).
254 However, we'd like to be able to have references from one chapter to
255 another, and have continuous numbering (pages and chapters, as
256 applicable). Of course, none of this is implemented yet. There has
257 been some thought put into some aspects; see `the "include"
258 directive`__ and the `Reference Merging`_ transform below.
259
260 When I was working with SGML in Japan, we had a system where there
261 was a top-level coordinating file, book.sgml, which contained the
262 top-level structure of a book: the <book> element, containing the
263 book <title> and empty component elements (<preface>, <chapter>,
264 <appendix>, etc.), each with filename attributes pointing to the
265 actual source for the component. Something like this::
266
267 <book id="bk01">
268 <title>Title of the Book</title>
269 <preface inrefid="pr01"></preface>
270 <chapter inrefid="ch01"></chapter>
271 <chapter inrefid="ch02"></chapter>
272 <chapter inrefid="ch03"></chapter>
273 <appendix inrefid="ap01"></appendix>
274 </book>
275
276 (The "inrefid" attribute stood for "insertion reference ID".)
277
278 The processing system would process each component separately, but
279 it would recognize and use the book file to coordinate chapter and
280 page numbering, and keep a persistent ID to (title, page number)
281 mapping database for cross-references. Docutils could use a similar
282 system for large-scale, multipart documents.
283
284 __ ../ref/rst/directives.html#including-an-external-document-fragment
285
286 Aahz's idea:
287
288 First the ToC::
289
290 .. ToC-list::
291 Introduction.rst
292 Objects.rst
293 Data.rst
294 Control.rst
295
296 Then a sample use::
297
298 .. include:: ToC.rst
299
300 As I said earlier in chapter :chapter:`Objects.rst`, the
301 reference count gets increased every time a binding is made.
302
303 Which produces::
304
305 As I said earlier in chapter 2, the
306 reference count gets increased every time a binding is made.
307
308 The ToC in this form doesn't even need to be references to actual
309 reST documents; I'm simply doing it that way for a minimum of
310 future-proofing, in case I do want to add the ability to pick up
311 references within external chapters.
312
313 Perhaps, instead of ToC (which would overload the "contents"
314 directive concept already in use), we could use "manifest". A
315 "manifest" directive might associate local reference names with
316 files::
317
318 .. manifest::
319 intro: Introduction.rst
320 objects: Objects.rst
321 data: Data.rst
322 control: Control.rst
323
324 Then the sample becomes::
325
326 .. include:: manifest.rst
327
328 As I said earlier in chapter :chapter:`objects`, the
329 reference count gets increased every time a binding is made.
330
331 * Add support for _`multiple output files` and _`generic data
332 handling`:
333
334 It should be possible for a component to **emit or reference** data
335 to be either **included or referenced** in the output document.
336 Examples of such data are stylesheets or images.
337
338 For this, we need a "data" object which stores the data either
339 inline or by referring to a file. The Docutils framework is
340 responsible for either:
341
342 * storing the data in the appropriate location (e.g. in the
343 directory of the output file, or in a user-specified directory)
344 and providing the paths of the stored files to the writer, *or*
345
346 * providing the data itself to the writer so that it can be embedded
347 in the output document.
348
349 This approach decouples data handling from the data source (which
350 can either be embedded or referenced) and the destination (which can
351 either be embedded or referenced as well).
352
353 See <http://article.gmane.org/gmane.text.docutils.devel/3631>.
354
355 * Add testing for Docutils' front end tools?
356
357 * Publisher: "Ordinary setup" shouldn't require specific ordering; at
358 the very least, there ought to be error checking higher up in the
359 call chain. [Aahz]
360
361 ``Publisher.get_settings`` requires that all components be set up
362 before it's called. Perhaps the I/O *objects* shouldn't be set, but
363 I/O *classes*. Then options are set up (``.set_options``), and
364 ``Publisher.set_io`` (or equivalent code) is called with source &
365 destination paths, creating the I/O objects.
366
367 Perhaps I/O objects shouldn't be instantiated until required. For
368 split output, the Writer may be called multiple times, once for each
369 doctree, and each doctree should have a separate Output object (with
370 a different path). Is the "Builder" pattern applicable here?
371
372 * Perhaps I/O objects should become full-fledged components (i.e.
373 subclasses of ``docutils.Component``, as are Readers, Parsers, and
374 Writers now), and thus have associated option/setting specs and
375 transforms.
376
377 * Multiple file I/O suggestion from Michael Hudson: use a file-like
378 object or something you can iterate over to get file-like objects.
379
380 * Add an "--input-language" option & setting? Specify a different
381 language module for input (bibliographic fields, directives) than
382 for output. The "--language" option would set both input & output
383 languages.
384
385 * Auto-generate reference tables for language-dependent features?
386 Could be generated from the source modules. A special command-line
387 option could be added to Docutils front ends to do this. (Idea from
388 Engelbert Gruber.)
389
390 * Enable feedback of some kind from internal decisions, such as
391 reporting the successful input encoding. Modify runtime settings?
392 System message? Simple stderr output?
393
394 * Rationalize Writer settings (HTML/LaTeX/PEP) -- share settings.
395
396 * Support "include" as embedded inline-compatible directive in substitution
397 definitions, e.g. ::
398
399 .. |version| include:: version.rst
400
401 This document describes version |version| of ...
402
403 (cf. Grzegorz Adam Hankiewicz's post from 2014-10-01 in docutils-devel)
404
405 * Add an ``:optional: <replacement text>`` option to the "include"
406 directive? This would not throw an error for a missing file, instead a
407 warning is given and ``<replacement text>`` is used instead. It would be
408 the responsibility of the author to ensure the missing file does not lead
409 to problems later in the document.
410
411 Use cases:
412
413 + Standard rST syntax to replace Sphinx's "literalinclude"::
414
415 .. include:: blah.cpp
416 :literal:
417 :optional: file ``blah.cpp`` not found
418
419 + Variable content taken from a file, e.g.
420
421 version.rst::
422
423 .. |version| replace:: 3.1
424
425 optionally used as::
426
427 .. include:: version.rst
428 :optional: .. |version| replace:: unknown
429
430 This document describes version |version| of ...
431
432 (cf. Grzegorz Adam Hankiewicz's post from 2014-10-01 in docutils-devel)
433
434 * Parameterize the Reporter object or class? See the `2004-02-18
435 "rest checking and source path"`_ thread.
436
437 .. _2004-02-18 "rest checking and source path":
438 http://thread.gmane.org/gmane.text.docutils.user/1112
439
440 * Add a "disable_transforms" setting? Would allow for easy syntax
441 checking. Where ("null" writer, generic, parser(s))?
442 Cf. the `2004-02-18 "rest checking and source path"`_ thread.
443
444 * Add a generic meta-stylesheet mechanism? An external file could
445 associate style names ("class" attributes) with specific elements.
446 Could be generalized to arbitrary output attributes; useful for HTML
447 & XMLs. Aahz implemented something like this in
448 sandbox/aahz/Effective/EffMap.py.
449
450 * .. _classes for table cells:
451
452 William Dode suggested that table cells be assigned "class"
453 attributes by columns, so that stylesheets can affect text
454 alignment. Unfortunately, there doesn't seem to be a way (in HTML
455 at least) to leverage the "colspec" elements (HTML "col" tags) by
456 adding classes to them. The resulting HTML is very verbose::
457
458 <td class="col1">111</td>
459 <td class="col2">222</td>
460 ...
461
462 At the very least, it should be an option. People who don't use it
463 shouldn't be penalized by increases in their HTML file sizes.
464
465 Table rows could also be assigned classes (like odd/even). That
466 would be easier to implement.
467
468 How should it be implemented?
469
470 * There could be writer options (column classes & row classes) with
471 standard values.
472
473 * The table directive could grow some options. Something like
474 ":cell-classes: col1 col2 col3" (either must match the number of
475 columns, or repeat to fill?) and ":row-classes: odd even" (repeat
476 to fill; body rows only, or header rows too?).
477
478 Probably per-table directive options are best. The "class" values
479 could be used by any writer, and applying such classes to all tables
480 in a document with writer options is too broad.
481
482 See also the `table_styling Sphinx extension`_ which defines
483
484 :widths: also in Docutils core (but different implementation)
485 :column-alignment: Sets per-column text alignment
486 :column-wrapping: Sets per-column text wrapping
487 :column-dividers: Add dividers between columns
488 :column-classes: Add per-column css classes.
489 :header-columns: Specify number of “stub” columns
490
491 .. _table_styling Sphinx extension: https://pythonhosted.org/cloud_sptheme/
492 lib/cloud_sptheme.ext.table_styling.html
493
494 * Add file-specific settings support to config files, like::
495
496 [file index.rst]
497 compact-lists: no
498
499 Is this even possible? Should the criterion be the name of the
500 input file or the output file? Alternative (more explicit) syntax::
501
502 [source_file index.rst]
503 ...
504
505 [dest_file index.html]
506 ...
507
508 Or rather allow settings configuration from the rst source file
509 (see misc.settings_ directive)?
510
511 * The "validator" support added to OptionParser is very similar to
512 "traits_" in SciPy_. Perhaps something could be done with them?
513 (Had I known about traits when I was implementing docutils.frontend,
514 I may have used them instead of rolling my own.)
515
516 .. _traits: http://code.enthought.com/traits/
517 .. _SciPy: http://www.scipy.org/
518
519 * Add support for _`plugins`.
520
521 * _`Config directories`: Currently, ~/.docutils, ./docutils.conf/, &
522 /etc/docutils.conf are read as configuration_ files. Proposal: allow
523 ~/.docutils to be a a configuration *directory*, along with
524 /etc/docutils/ and ./docutils.conf/. Within these directories,
525 check for config.rst files. We can also have subdirectories here,
526 for plugins, S5 themes, components (readers/writers/parsers) etc.
527
528 Docutils will continue to support configuration files for backwards
529 compatibility.
530
531 * Add support for document decorations other than headers & footers?
532 For example, top/bottom/side navigation bars for web pages. Generic
533 decorations?
534
535 Seems like a bad idea as long as it isn't independent from the output
536 format (for example, navigation bars are only useful for web pages).
537
538 * docutils_update: Check for a ``Makefile`` in a directory, and run
539 ``make`` if found? This would allow for variant processing on
540 specific source files, such as running ``rst2s5`` instead of
541 ``rst2html``.
542
543 * Add a "disable table of contents" setting? The S5 writer could set
544 it as a default. Rationale:
545
546 The ``contents`` (table of contents) directive must not be used
547 [in S5/HTML documents]. It changes the CSS class of headings
548 and they won't show up correctly in the screen presentation.
549
550 -- `Easy Slide Shows With reStructuredText & S5
551 <../user/slide-shows.html>`_
552
553 Analogue to the ``sectnum_xform`` setting, it could be used by the
554 latex writer to switch to a LaTeX generated ToC (currently, the latex
555 writer calls it "use_latex_toc").
556
557 object numbering and object references
558 --------------------------------------
559
560 For equations, tables & figures.
561
562 These would be the equivalent of DocBook's "formal" elements.
563
564 In LaTeX, automatic counters are implemented for sections, equations and
565 floats (figures, tables) (configurable via stylesheets or in the
566 latex-preamble). Objects can be given `reference names`_ with the
567 ``\label{<refname}`` command, ``\ref{<refname>}`` inserts the
568 corresponding number.
569
570 No such mechanism exists in HTML/CSS (there is "target-counter" for paged
571 media but this is not supported by browsers as of 2024).
572 Cf. https://stackoverflow.com/questions/16453488/ and
573 https://stackoverflow.com/questions/9463523/.
574
575 * We need _`persistent sequences`, similar to chapter and footnote
576 numbers. See `OpenOffice.org XML`_ "fields".
577
578 - Should the sequences be automatic or manual (user-specifyable)?
579
580 * It is already possible to give `reference names`_ to objects via
581 internal hyperlink targets or the "name" directive option::
582
583 .. _figure name:
584
585 .. figure:: image.png
586
587 or ::
588
589 .. figure:: image.png
590 :name: figure name
591
592 Improve the mapping of "phrase references" to IDs/labels with Literal
593 transcription (i.e. ü -> ue, ß -> ss, å -> aa) instead of just
594 stripping the accents and other non-ASCII chars. See also the feature
595 request `allow more characters when transforming "names" to "ids"`__.
596
597 A "table" directive has been implemented, supporting table titles.
598
599 Perhaps the name could derive from the title/caption?
600
601 .. _reference names: ../ref/rst/restructuredtext.html#reference-names
602 __ https://sourceforge.net/p/docutils/feature-requests/66/
603
604 * We need syntax for object references. Cf. `OpenOffice.org XML`_
605 "reference fields":
606
607 - Parameterized substitutions are too complicated
608 (cf. `or not to do`: `object references`_)
609
610 - An interpreted text approach is simpler and better::
611
612 See Figure :ref:`figure name` and Equation :ref:`eq:identity`.
613
614 - "equation", "figure", and "page" roles could generate appropriate
615 boilerplate text::
616
617 See :figure:`figure name` on :page:`figure name`.
618
619 See `Interpreted Text`_ below.
620
621 Reference boilerplate could be specified in the document
622 (defaulting to nothing)::
623
624 .. fignum::
625 :prefix-ref: "Figure "
626 :prefix-caption: "Fig. "
627 :suffix-caption: :
628
629 The position of the role (prefix or suffix) could also be utilized
630
631 .. _OpenOffice.org XML: http://xml.openoffice.org/
632 .. _object references: rst/alternatives.html#object-references
633
634
635 Documentation
636 =============
637
638 User Docs
639 ---------
640
641 * Add a FAQ entry about using Docutils (with reStructuredText) on a
642 server and that it's terribly slow. See the first paragraphs in
643 <http://article.gmane.org/gmane.text.docutils.user/1584>.
644
645 * Add document about what Docutils has previously been used for
646 (web/use-cases.rst?).
647
648 * Improve index in docs/user/config.rst.
649
650
651 Developer Docs
652 --------------
653
654 * Improve the internal module documentation (docstrings in the code).
655 Specific deficiencies listed below.
656
657 - docutils.parsers.rst.states.State.build_table: data structure
658 required (including StringList).
659
660 - docutils.parsers.rst.states: more complete documentation of parser
661 internals.
662
663 * docs/ref/doctree.rst: DTD element structural relationships,
664 semantics, and attributes. In progress; element descriptions to be
665 completed.
666
667 * Document the ``pending`` elements, how they're generated and what
668 they do.
669
670 * Document the transforms_ (perhaps in docstrings?): how they're used,
671 what they do, dependencies & order considerations. In progress.
672
673 * Document the HTML classes used by html4css1.py.
674
675 * Write an overview of the Docutils architecture, as an introduction
676 for developers. What connects to what, why, and how. Either update
677 PEP 258 (see PEPs_ below) or as a separate doc.
678
679 * Give information about unit tests. Maybe as a howto?
680
681 * Document the docutils.nodes APIs.
682
683 * Complete the docs/api/publisher.rst docs.
684
685
686 How-Tos
687 -------
688
689 * Creating Docutils Writers
690
691 * Creating Docutils Readers
692
693 * Creating Docutils Transforms_
694
695 * Creating Docutils Parsers
696
697 * Using Docutils as a Library
698
699
700 PEPs
701 ----
702
703 * Complete PEP 258 Docutils Design Specification.
704
705 - Fill in the blanks in API details.
706
707 - Specify the nodes.py internal data structure implementation?
708
709 [Tibs:] Eventually we need to have direct documentation in
710 there on how it all hangs together - the DTD is not enough
711 (indeed, is it still meant to be correct? [Yes, it is.
712 --DG]).
713
714 * Rework PEP 257, separating style from spec from tools, wrt Docutils?
715 See Doc-SIG from 2001-06-19/20.
716
717
718 Python Source Reader
719 ====================
720
721 General:
722
723 * Analyze Tony Ibbs' PySource code.
724
725 * Analyze Doug Hellmann's HappyDoc project.
726
727 * Investigate how POD handles literate programming.
728
729 * Take the best ideas and integrate them into Docutils.
730
731 Miscellaneous ideas:
732
733 * Ask Python-dev for opinions (GvR for a pronouncement) on special
734 variables (__author__, __version__, etc.): convenience vs. namespace
735 pollution. Ask opinions on whether or not Docutils should recognize
736 & use them.
737
738 * If we can detect that a comment block begins with ``##``, a la
739 JavaDoc, it might be useful to indicate interspersed section headers
740 & explanatory text in a module. For example::
741
742 """Module docstring."""
743
744 ##
745 # Constants
746 # =========
747
748 a = 1
749 b = 2
750
751 ##
752 # Exception Classes
753 # =================
754
755 class MyException(Exception): pass
756
757 # etc.
758
759 * Should standalone strings also become (module/class) docstrings?
760 Under what conditions? We want to prevent arbitrary strings from
761 becoming docstrings of prior attribute assignments etc. Assume
762 that there must be no blank lines between attributes and attribute
763 docstrings? (Use lineno of NEWLINE token.)
764
765 Triple-quotes are sometimes used for multi-line comments (such as
766 commenting out blocks of code). How to reconcile?
767
768 * HappyDoc's idea of using comment blocks when there's no docstring
769 may be useful to get around the conflict between `additional
770 docstrings`_ and ``from __future__ import`` for module docstrings.
771 A module could begin like this::
772
773 #!/usr/bin/env python
774 # :Author: Me
775 # :Copyright: whatever
776
777 """This is the public module docstring (``__doc__``)."""
778
779 # More docs, in comments.
780 # All comments at the beginning of a module could be
781 # accumulated as docstrings.
782 # We can't have another docstring here, because of the
783 # ``__future__`` statement.
784
785 from __future__ import division
786
787 Using the JavaDoc convention of a doc-comment block beginning with
788 ``##`` is useful though. It allows doc-comments and implementation
789 comments.
790
791 .. _additional docstrings:
792 ../peps/pep-0258.html#additional-docstrings
793
794 * HappyDoc uses an initial comment block to set "parser configuration
795 values". Do the same thing for Docutils, to set runtime settings on
796 a per-module basis? I.e.::
797
798 # Docutils:setting=value
799
800 Could be used to turn on/off function parameter comment recognition
801 & other marginal features. Could be used as a general mechanism to
802 augment config files and command-line options (but which takes
803 precedence?).
804
805 * Multi-file output should be divisible at arbitrary level.
806
807 * Support all forms of ``import`` statements:
808
809 - ``import module``: listed as "module"
810 - ``import module as alias``: "alias (module)"
811 - ``from module import identifier``: "identifier (from module)"
812 - ``from module import identifier as alias``: "alias (identifier
813 from module)"
814 - ``from module import *``: "all identifiers (``*``) from module"
815
816 * Have links to colorized Python source files from API docs? And
817 vice-versa: backlinks from the colorized source files to the API
818 docs!
819
820 * In summaries, use the first *sentence* of a docstring if the first
821 line is not followed by a blank line.
822
823
824 reStructuredText Parser
825 =======================
826
827 Also see the `... Or Not To Do?`__ list.
828
829 __ rst/alternatives.html#or-not-to-do
830
831
832 Misc
833 ----
834
835 * A list problem::
836
837 * foo
838 * bar
839 * baz
840
841 This ends up as a definition list. This is more of a usability
842 issue.
843
844 * This case is probably meant to be a nested list, but it ends up as a
845 list inside a block-quote without an error message::
846
847 - foo
848
849 - bar
850
851 It should probably just be an error.
852
853 The problem with this is that you don't notice easily in HTML that
854 it's not a nested list but a block-quote -- there's not much of a
855 visual difference.
856
857 * Treat enumerated lists that are not arabic and consist of only one
858 item in a single line as ordinary paragraphs. See
859 <http://article.gmane.org/gmane.text.docutils.user/2635>.
860
861 * The citation syntax could use some improvements. See
862 <http://thread.gmane.org/gmane.text.docutils.user/2499> (and the
863 sub-thread at
864 <http://thread.gmane.org/gmane.text.docutils.user/2499/focus=3028>,
865 and the follow-ups at
866 <http://thread.gmane.org/gmane.text.docutils.user/3087>,
867 <http://thread.gmane.org/gmane.text.docutils.user/3110>,
868 <http://thread.gmane.org/gmane.text.docutils.user/3114>),
869 <http://thread.gmane.org/gmane.text.docutils.user/2443>,
870 <http://thread.gmane.org/gmane.text.docutils.user/2715>,
871 <http://thread.gmane.org/gmane.text.docutils.user/3027>,
872 <http://thread.gmane.org/gmane.text.docutils.user/3120>,
873 <http://thread.gmane.org/gmane.text.docutils.user/3253>.
874
875 * The current list-recognition logic has too many false positives, as
876 in ::
877
878 * Aorta
879 * V. cava superior
880 * V. cava inferior
881
882 Here ``V.`` is recognized as an enumerator, which leads to
883 confusion. We need to find a solution that resolves such problems
884 without complicating the spec to much.
885
886 See <http://thread.gmane.org/gmane.text.docutils.user/2524>.
887
888 * Add indirect links via citation references & footnote references.
889 Example::
890
891 `Goodger (2005)`_ is helpful.
892
893 .. _Goodger (2005): [goodger2005]_
894 .. [goodger2005] citation text
895
896 See <http://thread.gmane.org/gmane.text.docutils.user/2499>.
897
898 * Complain about bad URI characters
899 (http://article.gmane.org/gmane.text.docutils.user/2046) and
900 disallow internal whitespace
901 (http://article.gmane.org/gmane.text.docutils.user/2214).
902
903 * Create ``info``-level system messages for unnecessarily
904 backslash-escaped characters (as in ``"\something"``, rendered as
905 "something") to allow checking for errors which silently slipped
906 through.
907
908 * Add (functional) tests for untested roles.
909
910 * Add test for ":figwidth: image" option of "figure" directive. (Test
911 code needs to check if PIL is available on the system.)
912
913 * Add support for CJK double-width whitespace (indentation) &
914 punctuation characters (markup; e.g. double-width "*", "-", "+")?
915
916 * Add motivation sections for constructs in spec.
917
918 * Support generic hyperlink references to _`targets in other
919 documents`? Not in an HTML-centric way, though (it's trivial to say
920 ``https://www.example.org/doc#name``, and useless in non-HTML
921 contexts). XLink/XPointer? ``.. baseref::``? See Doc-SIG
922 2001-08-10.
923
924 * Implement the header row separator modification to table.el. (Wrote
925 to Takaaki Ota & the table.el mailing list on 2001-08-12, suggesting
926 support for "=====" header rows. On 2001-08-17 he replied, saying
927 he'd put it on his to-do list, but "don't hold your breath".)
928
929 * Fix the parser's indentation handling to conform with the stricter
930 definition in the spec. (Explicit markup blocks should be strict or
931 forgiving?)
932
933 .. XXX What does this mean? Can you elaborate, David?
934
935 * Make the parser modular. Allow syntax constructs to be added or
936 disabled at run-time. Subclassing is probably not enough because it
937 makes it difficult to apply multiple extensions.
938
939 * Generalize the "doctest block" construct (which is overly
940 Python-centric) to other interactive sessions? "Doctest block"
941 could be renamed to "I/O block" or "interactive block", and each of
942 these could also be recognized as such by the parser:
943
944 - Shell sessions::
945
946 $ cat example1.rst
947 A block beginning with a "$ " prompt is interpreted as a shell
948 session interactive block. As with Doctest blocks, the
949 interactive block ends with the first blank line, and wouldn't
950 have to be indented.
951
952 - Root shell sessions::
953
954 # cat example2.rst
955 A block beginning with a "# " prompt is interpreted as a root
956 shell session (the user is or has to be logged in as root)
957 interactive block. Again, the block ends with a blank line.
958
959 Other standard (and unambiguous) interactive session prompts could
960 easily be added (such as "> " for WinDOS).
961
962 Tony Ibbs spoke out against this idea (2002-06-14 Doc-SIG thread
963 "docutils feedback").
964
965 * Add support for pragma (syntax-altering) directives.
966
967 Some pragma directives could be local-scope unless explicitly
968 specified as global/pragma using ":global:" options.
969
970 * Support whitespace in angle-bracketed standalone URLs according to
971 Appendix E ("Recommendations for Delimiting URI in Context") of
972 :RFC:`2396`.
973
974 * Use the vertical spacing of the source text to determine the
975 corresponding vertical spacing of the output?
976
977 * [From Mark Nodine] For cells in simple tables that comprise a
978 single line, the justification can be inferred according to the
979 following rules:
980
981 1. If the text begins at the leftmost column of the cell,
982 then left justification, ELSE
983 2. If the text begins at the rightmost column of the cell,
984 then right justification, ELSE
985 3. Center justification.
986
987 The onus is on the author to make the text unambiguous by adding
988 blank columns as necessary. There should be a parser setting to
989 turn off justification-recognition (normally on would be fine).
990
991 Decimal justification?
992
993 All this shouldn't be done automatically. Only when it's requested
994 by the user, e.g. with something like this::
995
996 .. table::
997 :auto-indent:
998
999 (Table goes here.)
1000
1001 Otherwise it will break existing documents.
1002
1003 * Generate a warning or info message for paragraphs which should have
1004 been lists, like this one::
1005
1006 1. line one
1007 3. line two
1008
1009 * Generalize the "target-notes" directive into a command-line option
1010 somehow? See docutils-develop 2003-02-13.
1011
1012 * Allow a "::"-only paragraph (first line, actually) to introduce a
1013 _`literal block without a blank line`? (Idea from Paul Moore.) ::
1014
1015 ::
1016 This is a literal block
1017
1018 Is indentation enough to make the separation between a paragraph
1019 which contains just a ``::`` and the literal text unambiguous?
1020 (There's one problem with this concession: If one wants a definition
1021 list item which defines the term "::", we'd have to escape it.) It
1022 would only be reasonable to apply it to "::"-only paragraphs though.
1023 I think the blank line is visually necessary if there's text before
1024 the "::"::
1025
1026 The text in this paragraph needs separation
1027 from the literal block following::
1028 This doesn't look right.
1029
1030 * Add new syntax for _`nested inline markup`? Or extend the parser to
1031 parse nested inline markup somehow? See the `collected notes
1032 <rst/alternatives.html#nested-inline-markup>`__.
1033
1034 * Drop the backticks from embedded URIs with omitted reference text?
1035 Should the angle brackets be kept in the output or not? ::
1036
1037 <file_name>_
1038
1039 Probably not worth the trouble.
1040
1041 * How about a syntax for alternative hyperlink behavior, such as "open
1042 in a new window" (as in HTML's ``<a target="_blank">``)?
1043
1044 The MoinMoin wiki uses a caret ("^") at the beginning of the URL
1045 ("^" is not a legal URI character). That could work for both inline
1046 and explicit targets::
1047
1048 The `reference docs <^url>`__ may be handy.
1049
1050 .. _name: ^url
1051
1052 This may be too specific to HTML. It hasn't been requested very
1053 often either.
1054
1055 * Add an option to add URI schemes at runtime.
1056
1057 * _`Segmented lists`::
1058
1059 : segment : segment : segment
1060 : segment : segment : very long
1061 segment
1062 : segment : segment : segment
1063
1064 The initial colon (":") can be thought of as a type of bullet
1065
1066 We could even have segment titles::
1067
1068 :: title : title : title
1069 : segment : segment : segment
1070 : segment : segment : segment
1071
1072 This would correspond well to DocBook's SegmentedList. Output could
1073 be tabular or "name: value" pairs, as described in DocBook's docs.
1074
1075 * Enable grid _`tables inside XML comments`, where "``--``" ends comments.
1076
1077 Implementation possibilities:
1078
1079 1. Make the table syntax characters into "table" directive options.
1080 This is the most flexible but most difficult, and we probably
1081 don't need that much flexibility.
1082
1083 2. Substitute "~" for "-" with a specialized directive option
1084 (e.g. ":tildes:").
1085
1086 3. Make the standard table syntax recognize "~" as well as "-", even
1087 without a directive option. Individual tables would have to be
1088 internally consistent.
1089
1090 4. Allow Unicode box characters for table markup
1091 (`feature request [6]`_)
1092
1093 Directive options are preferable to configuration settings, because
1094 tables are document-specific. A pragma directive would be another
1095 approach, to set the syntax once for a whole document.
1096
1097 Unicode box character markup would kill two birds with one stone.
1098
1099 In the meantime, the list-table_ directive is a good replacement for
1100 grid tables inside XML comments.
1101
1102 .. _feature request [6]:
1103 https://sourceforge.net/p/docutils/feature-requests/6
1104 .. _list-table: ../ref/rst/directives.html#list-table
1105
1106
1107 * Generalize docinfo contents (bibliographic fields): remove specific
1108 fields, and have only a single generic "field"?
1109
1110 * _`Line numbers` and "source" in system messages:
1111
1112 - Add "source" and "line" keyword arguments to all Reporter calls?
1113 This would require passing source/line arguments along all
1114 intermediate functions (where currently only `line` is used).
1115
1116 Or rather specify "line" only if actually needed?
1117
1118 Currently, `document.reporter` uses a state machine instance to
1119 determine the "source" and "line" info from
1120 `statemachine.input_lines` if not given explicitly. Except for
1121 special cases, the "line" argument is not needed because,
1122 `document.statemachine` keeps record of the current line number.
1123
1124 - For system messages generated after the parsing is completed (i.e. by
1125 transforms or the writer) "line" info must be present in the doctree
1126 elements.
1127
1128 Elements' .line assignments should be checked. (Assign to .source
1129 too? Add a set_info method? To what?)
1130
1131 The "source" (and line number in the source) can either be added
1132 explicitly to the elements or determined from the “raw” line
1133 number by `document.statemachine.get_source_and_line`.
1134
1135 - Some line numbers in elements are not being set properly
1136 (explicitly), just implicitly/automatically. See rev. 1.74 of
1137 docutils/parsers/rst/states.py for an example of how to set.
1138
1139 - See also `feature requests #41`__
1140
1141 __ https://sourceforge.net/p/docutils/feature-requests/41/
1142
1143 * Unprintable characters like NULL in the rST source are in most cases
1144 an indication of a problem (corrupt source file, wrong encoding, ...).
1145 The same goes for combining characters at the start of a line, etc.
1146 It may be helpful, if Docutils issued a Warning for problematic
1147 characters in the source (except for literals).
1148
1149
1150 Adaptable file extensions
1151 -------------------------
1152
1153 Questions
1154 `````````
1155
1156 Should Docutils support adaptable file extensions in hyperlinks?
1157
1158 In the rST source, sister documents are ".rst" files. If we're
1159 generating HTML, then ".html" is appropriate; if PDF, then ".pdf";
1160 etc.
1161
1162 Handle documents only, or objects (images, etc.) also?
1163
1164 Different output formats support different sets of image formats (HTML
1165 supports ".svg" but not ".pdf", pdfLaTeX supports ".pdf" but not ".svg",
1166 LaTeX supports only ".eps").
1167
1168 This is less urgent 2020 than 2004, as `pdflatex` and `lualatex` are
1169 now standard and support most image formats. Also, a wrapper like
1170 `rubber`__ that provides on-the-fly image conversion depends on the
1171 "wrong" extension in the LaTeX source.
1172
1173 __ https://pypi.org/project/rubber/
1174
1175 At what point should the extensions be substituted?
1176
1177 Transforms_:
1178 Fits well in the `Reader → Transformer → Writer`__ processing framework.
1179
1180 * Filename/URL extension replacement can be done walking over the
1181 Document tree transforming the document tree from a valid state
1182 to another valid state.
1183
1184 * Writer-specific configuration is still possible in the
1185 respective sections of the configuration_ file.
1186
1187 __ ../peps/pep-0258.html#id24
1188
1189 Pre- or post-processing:
1190 Can be implemented independent of Docutils -- keeps Docutils simple.
1191
1192 ... those who need more sophisticated filename extension
1193 tweaking can simply use regular expressions, which isn't too
1194 difficult due to the determinability of the writers. So there
1195 is no need to add a complex filename-extension-handling feature
1196 to Docutils.
1197
1198 --- `Lea Wiemann in docutils-users 2004-06-04`__
1199
1200 __ https://sourceforge.net/p/docutils/mailman/message/6918089/
1201
1202
1203 Proposals
1204 `````````
1205
1206 How about using ".*" to indicate "choose the most appropriate filename
1207 extension"? For example::
1208
1209 .. _Another Document: another.*
1210
1211 * My point about using ``.*`` is that any other mechanism inside reST
1212 leads to too many ambiguities in reading reST documents; at least
1213 with ``.*`` it's clear that some kind of substitution is going on.
1214
1215 --- Aahz
1216
1217 * What is to be done for output formats that don't *have* hyperlinks?
1218 For example, LaTeX targeted at print. Hyperlinks may be "called
1219 out", as footnotes with explicit URLs. (Don't convert the links.)
1220
1221 But then there's also LaTeX targeted at PDFs, which *can* have
1222 links. Perhaps a runtime setting for "*" could explicitly provide
1223 the extension, defaulting to the output file's extension.
1224
1225 * If this handles images also, how to differentiate between document
1226 and image links? Element context (within "image")? Which image
1227 extension to use for which document format? For HTML output, there
1228 is no reliable way of determining which extension to use (svg, png,
1229 jpg, jpeg, gif, ...).
1230
1231 Should the system check for existing files? No, not practical (the
1232 image files may be not available when the document is processed to HTML).
1233
1234 Mailing list threads: `Images in both HTML and LaTeX`__ (especially
1235 `this summary of Lea's objections`__).
1236
1237 __ https://sourceforge.net/p/docutils/mailman/docutils-users/thread/40BAA4B7.5020801%40python.org/#msg6918066
1238 __ https://sourceforge.net/p/docutils/mailman/message/6918089/
1239
1240 Chris Liechti suggests a new ``:link:`` role in `more-universal
1241 links?`__::
1242
1243 .. role:: link(rewrite)
1244 :transform: .rst|.html
1245
1246 and then to use it::
1247
1248 for more information see :link:`README.rst`
1249
1250 it would be useful if it supported an additional option
1251 ``:format: html`` so that separate rules for each format can be
1252 defined. (like the "raw" role)
1253
1254 __ https://sourceforge.net/p/docutils/mailman/message/6919484/
1255
1256
1257 Idea from Jim Fulton: an external lookup table of targets:
1258
1259 I would like to specify the extension (e.g. .rst) [in the
1260 source, rather than ``filename.*``], but tell the converter to
1261 change references to the files anticipating that the files will
1262 be converted too.
1263
1264 For example::
1265
1266 .. _Another Document: another.rst
1267
1268 rst2html --convert-links "another.rst bar.rst" foo.rst
1269
1270 That is, name the files for which extensions should be converted.
1271
1272 Note that I want to refer to original files in the original text
1273 (another.rst rather than another.*) because I want the
1274 unconverted text to stand on its own.
1275
1276 Note that in most cases, people will be able to use globs::
1277
1278 rst2html --convert-link-extensions-for "`echo *.rst`" foo.rst
1279
1280 It might be nice to be able to use multiple arguments, as in::
1281
1282 rst2html --convert-link-extensions-for *.rst -- foo.rst
1283
1284 > Handle documents only, or objects (images, etc.) also?
1285
1286 No, documents only, but there really is no need for guesswork.
1287 Just get the file names as command-line arguments. EIBTI
1288 [explicit is better than implicit].
1289
1290 In `Patch #169`__ `Hyperlink extension rewriting`, John L. Clark
1291 suggests command line options that map to-be-changed file extensions, e.g.::
1292
1293 rst2html --map-extension rst html --map-extension jpg png \
1294 input-filename.rst
1295
1296 __ https://sourceforge.net/p/docutils/patches/169/
1297
1298 Specifying the mapping as regular expressions would make this
1299 approach more generic and easier to implement (use ``re.replace``
1300 and refer to the "re" module's documentation instead of coding and
1301 documenting a home-grown extraction and mapping procedure).
1302
1303
1304 Math Markup
1305 -----------
1306
1307 * Use a "Transform" for math format conversions as extensively discussed
1308 in the `math directive issues`__ thread in May 2008?
1309
1310 __ http://osdir.com/ml/text.docutils.devel/2008-05/threads.html
1311
1312 * Generic `math-output setting`_ (currently specific to HTML).
1313 (List of math-output preferences?)
1314
1315 * Try to be compatible with `Math support in Sphinx`_?
1316
1317 * The ``:label:`` option selects a label for the equation, by which it
1318 can be cross-referenced, and causes an equation number to be issued.
1319 In Docutils, the option ``:name:`` sets the label.
1320 Equation numbering is not implemented yet.
1321
1322 * Option ``:nowrap:`` prevents wrapping of the given math in a
1323 math environment (you have to specify the math environment in the
1324 content).
1325
1326 .. _Math support in Sphinx: http://sphinx.pocoo.org/ext/math.html
1327
1328 * Equation numbering and references. (see the section on
1329 `object numbering and object references` for equations,
1330 formal tables, and images.)
1331
1332 .. _math-output setting: ../user/config.html#math-output
1333
1334
1335 alternative input formats
1336 `````````````````````````
1337
1338 Use a directive option to specify an alternative input format, e.g. (but not
1339 limited to):
1340
1341 MathML_
1342 Not for hand-written code but maybe useful when pasted in (or included
1343 from a file)
1344
1345 For an overview of MathML implementations and tests, see, e.g.,
1346 the `mathweb wiki`_ or the `ConTeXT MathML page`_.
1347
1348 .. _MathML: https://www.w3.org/TR/MathML2/
1349 .. _mathweb wiki: http://www.mathweb.org/wiki/MathML
1350 .. _ConTeXT MathML page: http://wiki.contextgarden.net/MathML
1351
1352 A MathML to LaTeX XSLT sheet:
1353 https://github.com/davidcarlisle/web-xslt/tree/master/pmml2tex
1354
1355
1356 ASCIIMath_
1357 Simple, ASCII based math input language (see also `ASCIIMath tutorial`_).
1358
1359 * The Python module ASCIIMathML_ translates a string with ASCIIMath into a
1360 MathML tree. Used, e.g., by MultiMarkdown__.
1361
1362 A more comprehensive implementation is ASCIIMathPython_ by
1363 Paul Trembley (also used in his sandbox projects).
1364
1365 * For conversion to LaTeX, there is
1366
1367 - a JavaScript script at
1368 http://dlippman.imathas.com/asciimathtex/ASCIIMath2TeX.js
1369
1370 - The javascript `asciimath-to-latex` AsciiMath to LaTex converter at
1371 the node package manager
1372 https://www.npmjs.com/package/asciimath-to-latex
1373 and at GitHub https://github.com/tylerlong/asciimath-to-latex
1374
1375 - a javascript and a PHP converter script at GitHub
1376 https://github.com/asciimath/asciimathml/tree/master/asciimath-based
1377
1378 .. _ASCIIMath: http://www1.chapman.edu/~jipsen/mathml/asciimath.html
1379 .. _ASCIIMath tutorial:
1380 http://www.wjagray.co.uk/maths/ASCIIMathTutorial.html
1381 .. _ASCIIMathML: http://pypi.python.org/pypi/asciimathml/
1382 .. _ASCIIMathPython: https://github.com/paulhtremblay/asciimathml
1383 __ http://fletcherpenney.net/multimarkdown/
1384
1385 `Unicode Nearly Plain Text Encoding of Mathematics`_
1386 format for lightly marked-up representation of mathematical
1387 expressions in Unicode.
1388
1389 (Unicode Technical Note. Sole responsibility for its contents rests
1390 with the author(s). Publication does not imply any endorsement by
1391 the Unicode Consortium.)
1392
1393 .. _Unicode Nearly Plain Text Encoding of Mathematics:
1394 https://www.unicode.org/notes/tn28/
1395
1396 itex
1397 See `the culmination of a relevant discussion in 2003
1398 <http://article.gmane.org/gmane.text.docutils.user/118>`__.
1399
1400
1401
1402 LaTeX output
1403 ````````````
1404
1405 Which equation environments should be supported by the math directive?
1406
1407 * one line:
1408
1409 + numbered: `equation`
1410 + unnumbered: `equation*`
1411
1412 * multiline (test for ``\\`` outside of a nested environment
1413 (e.g. `array` or `cases`)
1414
1415 + numbered: `align` (number every line)
1416
1417 (To give one common number to all lines, put them in a `split`
1418 environment. Docutils then places it in an `equation` environment.)
1419
1420 + unnumbered: `align*`
1421
1422 + Sphinx math also supports `gather` (checking for blank lines in
1423 the content). Docutils puts content blocks separated by blank
1424 lines in separate math-block doctree nodes. (The only difference of
1425 `gather` to two consecutive "normal" environments seems to be that
1426 page-breaks between the two are prevented.)
1427
1428 See http://www.math.uiuc.edu/~hildebr/tex/displays.html.
1429
1430
1431 HTML output
1432 ```````````
1433
1434 There is no native math support in HTML4. HTML5 has built-in support for
1435 MathML. MathML is supported by all major browsers since 2023.
1436
1437 For supported math output variants see the `math-output setting`_.
1438
1439 MathML_
1440 Additional converters from LaTeX to MathML
1441
1442 * TeX4ht_ (TeX based)
1443 * `MathJax for Node`_
1444
1445 .. _MathML: https://www.w3.org/TR/MathML2/
1446 .. _TeX4ht: http://www.tug.org/applications/tex4ht/mn.html
1447 .. _MathJax for Node: https://github.com/mathjax/MathJax-node
1448
1449
1450 HTML/CSS
1451 format math in standard HTML enhanced by CSS rules
1452 (`Examples and experiments`__).
1453 The ``math-output=html`` option uses the converter from eLyXer_
1454 (included with Docutils).
1455
1456 Alternatives: LaTeX-math to HTML/CSS converters include
1457
1458 * Hevea_ (Objective Caml)
1459 * `MathJax for Node`_
1460 * KaTeX_
1461
1462 __ http://www.zipcon.net/~swhite/docs/math/math.html
1463 .. _elyxer: http://elyxer.nongnu.org/
1464 .. _Hevea: http://para.inria.fr/~maranget/hevea/
1465 .. _KaTeX: https://katex.org
1466
1467
1468 OpenOffice output
1469 `````````````````
1470
1471 * The `OpenDocument standard`_ version 1.1 says:
1472
1473 Mathematical content is represented by MathML 2.0
1474
1475 However, putting MathML into an ODP file seems tricky as these
1476 (maybe outdated) links suppose:
1477 http://idippedut.dk/post/2008/01/25/Do-your-math-ODF-and-MathML.aspx
1478 http://idippedut.dk/post/2008/03/03/Now-I-get-it-ODF-and-MathML.aspx
1479
1480 .. _OpenDocument standard:
1481 http://www.oasis-open.org/standards#opendocumentv1.1
1482
1483 * OOoLaTeX__: "a set of macros designed to bring the power of LaTeX
1484 into OpenOffice."
1485
1486 __ http://ooolatex.sourceforge.net/
1487
1488
1489 Directives
1490 ----------
1491
1492 Directives below are often referred to as "module.directive", the
1493 directive function. The "module." is not part of the directive name
1494 when used in a document.
1495
1496 * Allow for field lists in list tables. See
1497 <http://thread.gmane.org/gmane.text.docutils.devel/3392>.
1498
1499 * .. _unify tables:
1500
1501 Unify table implementations and unify options of table directives
1502 (http://article.gmane.org/gmane.text.docutils.user/1857).
1503
1504 * Allow directives to be added at run-time?
1505
1506 * Use the language module for directive option names?
1507
1508 * Add "substitution_only" and "substitution_ok" function attributes,
1509 and automate context checking?
1510
1511 * Implement options or features on existing directives:
1512
1513 - All directives that produce titled elements should grow implicit
1514 reference names based on the titles.
1515
1516 - Allow the _`:trim:` option for all directives when they occur in a
1517 substitution definition, not only the unicode_ directive.
1518
1519 .. _unicode: ../ref/rst/directives.html#unicode-character-codes
1520
1521 - Add the "class" option to the unicode_ directive. For example, you
1522 might want to get characters or strings with borders around them.
1523
1524 - _`images.figure`: "title" and "number", to indicate a formal
1525 figure?
1526
1527 - _`parts.sectnum`: "local"?, "refnum"
1528
1529 A "local" option could enable numbering for sections from a
1530 certain point down, and sections in the rest of the document are
1531 not numbered. For example, a reference section of a manual might
1532 be numbered, but not the rest. OTOH, an all-or-nothing approach
1533 would probably be enough.
1534
1535 The "sectnum" directive should be usable multiple times in a
1536 single document. For example, in a long document with "chapter"
1537 and "appendix" sections, there could be a second "sectnum" before
1538 the first appendix, changing the sequence used (from 1,2,3... to
1539 A,B,C...). This is where the "local" concept comes in. This part
1540 of the implementation can be left for later.
1541
1542 A "refnum" option (better name?) would insert reference names
1543 (targets) consisting of the reference number. Then a URL could be
1544 of the form ``http://host/document.html#2.5`` (or "2-5"?). Allow
1545 internal references by number? Allow name-based *and*
1546 number-based ids at the same time, or only one or the other (which
1547 would the table of contents use)? Usage issue: altering the
1548 section structure of a document could render hyperlinks invalid.
1549
1550 - _`parts.contents`: Add a "suppress" or "prune" option? It would
1551 suppress contents display for sections in a branch from that point
1552 down. Or a new directive, like "prune-contents"?
1553
1554 Add an option to include topics in the TOC? Another for sidebars?
1555 The "topic" directive could have a "contents" option, or the
1556 "contents" directive" could have an "include-topics" option. See
1557 docutils-develop 2003-01-29.
1558
1559 - _`parts.header` & _`parts.footer`: Support multiple, named headers
1560 & footers? For example, separate headers & footers for odd, even,
1561 and the first page of a document.
1562
1563 This may be too specific to output formats which have a notion of
1564 "pages".
1565
1566 - _`misc.class`:
1567
1568 - Add a ``:parent:`` option for setting the parent's class
1569 (http://article.gmane.org/gmane.text.docutils.devel/3165).
1570
1571 - _`misc.include`:
1572
1573 - Option to label lines?
1574
1575 - How about an environment variable, say RSTINCLUDEPATH or
1576 RSTPATH, for standard includes (as in ``.. include:: <name>``)?
1577 This could be combined with a setting/option to allow
1578 user-defined include directories.
1579
1580 - Add support for inclusion by URL? ::
1581
1582 .. include::
1583 :url: https://www.example.org/inclusion.rst
1584
1585 - Strip blank lines from begin and end of a literal included file or
1586 file section. This would correspond to the way a literal block is
1587 handled.
1588
1589 As nodes.literal_block expects (and we have) the text as a string
1590 (rather than a list of lines), using a regexp seems the way.
1591
1592 - _`misc.raw`: add a "destination" option to the "raw" directive? ::
1593
1594 .. raw:: html
1595 :destination: head
1596
1597 <link ...>
1598
1599 It needs thought & discussion though, to come up with a consistent
1600 set of destination labels and consistent behavior.
1601
1602 And placing HTML code inside the <head> element of an HTML
1603 document is rather the job of a templating system.
1604
1605 - _`body.sidebar`: Allow internal section structure? Adornment
1606 styles would be independent of the main document.
1607
1608 That is really complicated, however, and the document model
1609 greatly benefits from its simplicity.
1610
1611 * Implement directives. Each of the list items below begins with an
1612 identifier of the form, "module_name.directive_function_name". The
1613 directive name itself could be the same as the
1614 directive_function_name, or it could differ.
1615
1616 - _`html.imagemap`
1617
1618 It has the disadvantage that it's only easily implementable for
1619 HTML, so it's specific to one output format.
1620
1621 (For non-HTML writers, the imagemap would have to be replaced with
1622 the image only.)
1623
1624 - _`parts.endnotes` (or "footnotes"): See `Footnote & Citation Gathering`_.
1625
1626 - _`parts.citations`: See `Footnote & Citation Gathering`_.
1627
1628 - _`misc.language`: Specify (= change) the language of a document at
1629 parse time?
1630
1631 * The misc.settings_ directive suggested below offers a more generic
1632 approach.
1633
1634 * The language of document parts can be indicated by the "special class
1635 value" ``"language-"`` + `BCP 47`_ language code. Class arguments to
1636 the title are attached to the document's base node - hence titled
1637 documents can be given a different language at parse time. However,
1638 "language by class attribute" does not change parsing (localized
1639 directives etc.), only supporting writers.
1640
1641 .. _BCP 47: https://www.rfc-editor.org/rfc/bcp/bcp47.txt
1642
1643
1644 - _`misc.settings`: Set any(?) Docutils runtime setting from within
1645 a document? Needs much thought and discussion.
1646
1647 Security concerns need to be taken into account (it shouldn't be
1648 possible to enable ``file_insertion_enabled`` from within a
1649 document), and settings that only would have taken effect before
1650 the directive (like ``tab-width``) shouldn't be accessible either.
1651
1652 See this sub-thread:
1653 <http://thread.gmane.org/gmane.text.docutils.user/3620/focus=3649>
1654
1655 - _`misc.gather`: Gather (move, or copy) all instances of a specific
1656 element. A generalization of the `Footnote & Citation Gathering`_
1657 ideas.
1658
1659 - Add a custom "directive" directive, equivalent to "role"? For
1660 example::
1661
1662 .. directive:: incr
1663
1664 .. class:: incremental
1665
1666 .. incr::
1667
1668 "``.. incr::``" above is equivalent to "``.. class:: incremental``".
1669
1670 Another example::
1671
1672 .. directive:: printed-links
1673
1674 .. topic:: Links
1675 :class: print-block
1676
1677 .. target-notes::
1678 :class: print-inline
1679
1680 This acts like macros. The directive contents will have to be
1681 evaluated when referenced, not when defined.
1682
1683 * Needs a better name? "Macro", "substitution"?
1684 * What to do with directive arguments & options when the
1685 macro/directive is referenced?
1686
1687 - Make the meaning of block quotes overridable? Only a 1-shot
1688 though; doesn't solve the general problem.
1689
1690 - _`conditional directives`:
1691
1692 .. note:: See also the implementation in Sphinx_.
1693
1694 Docutils already has the ability to say "use this content for
1695 Writer X" via the "raw" directive. It also does have the ability
1696 to say "use this content for any Writer other than X" via the
1697 "strip-elements with class" config value. However, using "raw"
1698 input just to select a special writer is inconvenient in many
1699 cases.
1700 It wouldn't be difficult to get more straightforward support, though.
1701
1702 My first idea would be to add a set of conditional directives.
1703 Let's call them "writer-is" and "writer-is-not" for discussion
1704 purposes (don't worry about implementation details). We might
1705 have::
1706
1707 .. writer-is:: text-only
1708
1709 ::
1710
1711 +----------+
1712 | SNMP |
1713 +----------+
1714 | UDP |
1715 +----------+
1716 | IP |
1717 +----------+
1718 | Ethernet |
1719 +----------+
1720
1721 .. writer-is:: pdf
1722
1723 .. figure:: protocol_stack.eps
1724
1725 .. writer-is-not:: text-only pdf
1726
1727 .. figure:: protocol_stack.png
1728
1729 This could be an interface to the Filter transform
1730 (docutils.transforms.components.Filter).
1731
1732 The ideas in the `adaptable file extensions`_ section above may
1733 also be applicable here.
1734
1735 SVG's "switch" statement may provide inspiration.
1736
1737 Here's an example of a directive that could produce multiple
1738 outputs (*both* raw troff pass-through *and* a GIF, for example)
1739 and allow the Writer to select. ::
1740
1741 .. eqn::
1742
1743 .EQ
1744 delim %%
1745 .EN
1746 %sum from i=o to inf c sup i~=~lim from {m -> inf}
1747 sum from i=0 to m sup i%
1748 .EQ
1749 delim off
1750 .EN
1751
1752 - _`body.example`: Examples; suggested by Simon Hefti. Semantics as
1753 per Docbook's "example"; admonition-style, numbered, reference,
1754 with a caption/title.
1755
1756 - _`body.index`: Index targets.
1757
1758 See `Index Entries & Indexes
1759 <./rst/alternatives.html#index-entries-indexes>`__.
1760
1761 - _`body.literal`: Literal block, possibly "formal" (see `object
1762 numbering and object references`_ above). Possible options:
1763
1764 - "highlight" a range of lines
1765
1766 - include only a specified range of lines
1767
1768 - "number" or "line-numbers"? (since 0.9 available with "code" directive)
1769
1770 - "styled" could indicate that the directive should check for
1771 style comments at the end of lines to indicate styling or
1772 markup.
1773
1774 Specific derivatives (i.e., a "python-interactive" directive)
1775 could interpret style based on cues, like the ">>> " prompt and
1776 "input()"/"raw_input()" calls.
1777
1778 See docutils-users 2003-03-03.
1779
1780 - _`body.listing`: Code listing with title (to be numbered
1781 eventually), equivalent of "figure" and "table" directives.
1782
1783 - _`pysource.usage`: Extract a usage message from the program,
1784 either by running it at the command line with a ``--help`` option
1785 or through an exposed API. [Suggestion for Optik.]
1786
1787 - _`body.float`: Generic float that can be used for figures, tables,
1788 code listings, flowcharts, ...
1789
1790 There is a Sphinx extension by Ignacio Fernández Galván <[email protected]>
1791
1792 I implemented something for generic floats in sphinx, and submitted a
1793 pull request that is still waiting::
1794
1795 .. float::
1796 :type: figure
1797 :caption: My caption
1798
1799 https://github.com/sphinx-doc/sphinx/pull/1858
1800
1801
1802 Interpreted Text
1803 ----------------
1804
1805 Interpreted text is entirely a reStructuredText markup construct, a
1806 way to get around built-in limitations of the medium. Some roles are
1807 intended to introduce new doctree elements, such as "title-reference".
1808 Others are merely convenience features, like "RFC".
1809
1810 All supported interpreted text roles must already be known to the
1811 Parser when they are encountered in a document. Whether pre-defined
1812 in core/client code, or in the document, doesn't matter; the roles
1813 just need to have already been declared. Adding a new role may
1814 involve adding a new element to the DTD and may require extensive
1815 support, therefore such additions should be well thought-out. There
1816 should be a limited number of roles.
1817
1818 The only place where no limit is placed on variation is at the start,
1819 at the Reader/Parser interface. Transforms are inserted by the Reader
1820 into the Transformer's queue, where non-standard elements are
1821 converted. Once past the Transformer, no variation from the standard
1822 Docutils doctree is possible.
1823
1824 An example is the Python Source Reader, which will use interpreted
1825 text extensively. The default role will be "Python identifier", which
1826 will be further interpreted by namespace context into <class>,
1827 <method>, <module>, <attribute>, etc. elements (see pysource.dtd),
1828 which will be transformed into standard hyperlink references, which
1829 will be processed by the various Writers. No Writer will need to have
1830 any knowledge of the Python-Reader origin of these elements.
1831
1832 * Add explicit interpreted text roles for the rest of the implicit
1833 inline markup constructs: named-reference, anonymous-reference,
1834 footnote-reference, citation-reference, substitution-reference,
1835 target, uri-reference (& synonyms).
1836
1837 * Add directives for each role as well? This would allow indirect
1838 nested markup::
1839
1840 This text contains |nested inline markup|.
1841
1842 .. |nested inline markup| emphasis::
1843
1844 nested ``inline`` markup
1845
1846 * Implement roles:
1847
1848 - "_`raw-wrapped`" (or "_`raw-wrap`"): Base role to wrap raw text
1849 around role contents.
1850
1851 For example, the following reStructuredText source ... ::
1852
1853 .. role:: red(raw-formatting)
1854 :prefix:
1855 :html: <font color="red">
1856 :latex: {\color{red}
1857 :suffix:
1858 :html: </font>
1859 :latex: }
1860
1861 colored :red:`text`
1862
1863 ... will yield the following document fragment::
1864
1865 <paragraph>
1866 colored
1867 <inline classes="red">
1868 <raw format="html">
1869 <font color="red">
1870 <raw format="latex">
1871 {\color{red}
1872 <inline classes="red">
1873 text
1874 <raw format="html">
1875 </font>
1876 <raw format="latex">
1877 }
1878
1879 Possibly without the intermediate "inline" node.
1880
1881 - _`"acronym" and "abbreviation"`: Associate the full text with a
1882 short form. Jason Diamond's description:
1883
1884 I want to translate ```reST`:acronym:`` into ``<acronym
1885 title='reStructuredText'>reST</acronym>``. The value of the
1886 title attribute has to be defined out-of-band since you can't
1887 parameterize interpreted text. Right now I have them in a
1888 separate file but I'm experimenting with creating a directive
1889 that will use some form of reST syntax to let you define them.
1890
1891 Should Docutils complain about undefined acronyms or
1892 abbreviations?
1893
1894 What to do if there are multiple definitions? How to
1895 differentiate between CSS (Content Scrambling System) and CSS
1896 (Cascading Style Sheets) in a single document? David Priest
1897 responds,
1898
1899 The short answer is: you don't. Anyone who did such a thing
1900 would be writing very poor documentation indeed. (Though I
1901 note that `somewhere else in the docs`__, there's mention of
1902 allowing replacement text to be associated with the
1903 abbreviation. That takes care of the duplicate
1904 acronyms/abbreviations problem, though a writer would be
1905 foolish to ever need it.)
1906
1907 __ `inline parameter syntax`_
1908
1909 How to define the full text? Possibilities:
1910
1911 1. With a directive and a definition list? ::
1912
1913 .. acronyms::
1914
1915 reST
1916 reStructuredText
1917 DPS
1918 Docstring Processing System
1919
1920 Would this list remain in the document as a glossary, or would
1921 it simply build an internal lookup table? A "glossary"
1922 directive could be used to make the intention clear.
1923 Acronyms/abbreviations and glossaries could work together.
1924
1925 Then again, a glossary could be formed by gathering individual
1926 definitions from around the document.
1927
1928 2. Some kind of `inline parameter syntax`_? ::
1929
1930 `reST <reStructuredText>`:acronym: is `WYSIWYG <what you
1931 see is what you get>`:acronym: plaintext markup.
1932
1933 .. _inline parameter syntax:
1934 rst/alternatives.html#parameterized-interpreted-text
1935
1936 3. A combination of 1 & 2?
1937
1938 The multiple definitions issue could be handled by establishing
1939 rules of priority. For example, directive-based lookup tables
1940 have highest priority, followed by the first inline definition.
1941 Multiple definitions in directive-based lookup tables would
1942 trigger warnings, similar to the rules of `implicit hyperlink
1943 targets`__.
1944
1945 __ ../ref/rst/restructuredtext.html#implicit-hyperlink-targets
1946
1947 4. Using substitutions? ::
1948
1949 .. |reST| acronym:: reST
1950 :text: reStructuredText
1951
1952 5. Use square brackets for positional and named options like AsciiDoc
1953 (cf. https://sourceforge.net/p/docutils/feature-requests/68/).
1954
1955 What do we do for other formats than HTML which do not support
1956 tool tips? Put the full text in parentheses?
1957
1958 - "figure", "table", "listing", "chapter", "page", etc: See `object
1959 numbering and object references`_ above.
1960
1961 - "glossary-term": This would establish a link to a glossary. It
1962 would require an associated "glossary-entry" directive, whose
1963 contents could be a definition list::
1964
1965 .. glossary-entry::
1966
1967 term1
1968 definition1
1969 term2
1970 definition2
1971
1972 This would allow entries to be defined anywhere in the document,
1973 and collected (via a "glossary" directive perhaps) at one point.
1974
1975
1976 Doctree pruning
1977 ---------------
1978
1979 [DG 2017-01-02: These are not definitive to-dos, just one developer's
1980 opinion. Added 2009-10-13 by Günter Milde, in r6178.]
1981 [Updated by GM 2017-02-04]
1982
1983 The number of doctree nodes can be reduced by "normalizing" some related
1984 nodes. This makes the document model and the writers somewhat simpler.
1985
1986 * The "doctest" element can be replaced by literal blocks with a class
1987 attribute (similar to the "code" directive output).
1988 The syntax shall be left in reST.
1989
1990 [DG 2017-01-02:] +0.
1991
1992 * "Normalize" special admonitions (note, hint, warning, ...) during parsing
1993 (similar to _`transforms.writer_aux.Admonitions`). There is no need to
1994 keep them as distinct elements in the doctree specification.
1995
1996 [DG 2017-01-02:] -1: <note>{body}</> is much more concise and
1997 expressive than <admonition><title>Note</>{body}</>, and the title
1998 translation can be put off until much later in the process.
1999
2000 [GM 2017-02-04]:
2001
2002 -0 for <admonition class=note><title>Note</>... instead of <note>:
2003 a document is rarely printed/used as doctree or XML.
2004
2005 +1 reduce the complexity of the doctree
2006 (there is no 1:1 rST syntax element <-> doctree node mapping anyway).
2007
2008 +1 every writer needs 9 visit_*/depart_* method pairs to handle the 9
2009 subtypes of an admonition, i.e. we could remove 72 redundant
2010 methods (HTML, LaTeX, Manpage, ODF).
2011
2012 -1 the most unfortunately named of these directives will survive. [#]_
2013
2014 .. [#] with "biblical touch" and hard to translate:
2015
2016 :admonition: | Ermahnung; Verweis; Warnung; Rüge
2017 | (exhortation; censure; warning; reprimand, rebuke)
2018
2019
2020 Keep the special admonition directives in reStructuredText syntax.
2021
2022 [DG 2017-01-02:] We must definitely keep the syntax. Removing it
2023 would introduce a huge backwards incompatibility.
2024
2025
2026 Unimplemented Transforms
2027 ========================
2028
2029 * _`Footnote & Citation Gathering`
2030
2031 Collect and move footnotes & citations to the end of a document or the
2032 place of a "footnotes" or "citations" directive
2033 (see `<../ref/rst/directives.html#references>`_)
2034
2035 Footnotes:
2036 Collect all footnotes that are referenced in the document before the
2037 directive (and after an eventually preceding ``.. footnotes::``
2038 directive) and insert at this place.
2039
2040 Allows "endnotes" at a configurable place.
2041
2042 Citations:
2043 Collect citations that are referenced ...
2044
2045 Citations can be:
2046
2047 a) defined in the document as citation elements
2048
2049 b) auto-generated from entries in a bibliographic database.
2050
2051 + based on bibstuff_?
2052 + also have a look at
2053
2054 * CrossTeX_, a backwards-compatible, improved bibtex
2055 re-implementation in Python (including HTML export).
2056 (development stalled since 2 years)
2057
2058 * Pybtex_,a drop-in replacement for BibTeX written in Python.
2059
2060 * BibTeX styles & (experimental) pythonic style API.
2061 * Database in BibTeX, BibTeXML and YAML formats.
2062 * full Unicode support.
2063 * Write to TeX, HTML and plain text.
2064
2065 * `Zotero plain <http://e6h.org/%7Eegh/hg/zotero-plain/>`__
2066 supports Zotero databases and CSL_ styles with Docutils with an
2067 ``xcite`` role.
2068
2069 * `sphinxcontrib-bibtex`_ Sphinx extension with "bibliography"
2070 directive and "cite" role supporting BibTeX databases.
2071
2072 * `Modified rst2html
2073 <http://www.loria.fr/~rougier/coding/article/rst2html.py>`__ by
2074 Nicolas Rougier.
2075
2076
2077 * Automatically insert a "References" heading?
2078
2079 .. _CrossTeX: http://www.cs.cornell.edu/people/egs/crosstex/
2080 .. _Pybtex: http://pybtex.sourceforge.net/
2081 .. _CSL: http://www.citationstyles.org/
2082 .. _sphinxcontrib-bibtex: http://sphinxcontrib-bibtex.readthedocs.org/
2083
2084 * _`Reference Merging`
2085
2086 When merging two or more subdocuments (such as docstrings),
2087 conflicting references may need to be resolved. There may be:
2088
2089 * duplicate reference and/or substitution names that need to be made
2090 unique; and/or
2091 * duplicate footnote numbers that need to be renumbered.
2092
2093 Should this be done before or after reference-resolving transforms
2094 are applied? What about references from within one subdocument to
2095 inside another?
2096
2097 * _`Document Splitting`
2098
2099 If the processed document is written to multiple files (possibly in
2100 a directory tree), it will need to be split up. Internal references
2101 will have to be adjusted.
2102
2103 (HTML only? Initially, yes. Eventually, anything should be
2104 splittable.)
2105
2106 Ideas:
2107
2108 - Insert a "destination" attribute into the root element of each
2109 split-out document, containing the path/filename. The Output
2110 object or Writer will recognize this attribute and split out the
2111 files accordingly. Must allow for common headers & footers,
2112 prev/next, breadcrumbs, etc.
2113
2114 - Transform a single-root document into a document containing
2115 multiple subdocuments, recursively. The content model of the
2116 "document" element would have to change to::
2117
2118 <!ELEMENT document
2119 ( (title, subtitle?)?,
2120 decoration?,
2121 (docinfo, transition?)?,
2122 %structure.model;,
2123 document* )>
2124
2125 (I.e., add the last line -- 0 or more document elements.)
2126
2127 Let's look at the case of hierarchical (directories and files)
2128 HTML output. Each document element containing further document
2129 elements would correspond to a directory (with an index.html file
2130 for the content preceding the subdocuments). Each document
2131 element containing no subdocuments (i.e., structure model elements
2132 only) corresponds to a concrete file with no directory.
2133
2134 The natural transform would be to map sections to subdocuments,
2135 but possibly only a given number of levels deep.
2136
2137 * _`Navigation`
2138
2139 If a document is split up, each segment will need navigation links:
2140 parent, children (small TOC), previous (preorder), next (preorder).
2141 Part of `Document Splitting`_?
2142
2143 * _`List of System Messages`
2144
2145 The ``system_message`` elements are inserted into the document tree,
2146 adjacent to the problems themselves where possible. Some (those
2147 generated post-parse) are kept until later, in
2148 ``document.messages``, and added as a special final section,
2149 "Docutils System Messages".
2150
2151 Docutils could be made to generate hyperlinks to all known
2152 system_messages and add them to the document, perhaps to the end of
2153 the "Docutils System Messages" section.
2154
2155 Fred L. Drake, Jr. wrote:
2156
2157 I'd like to propose that both parse- and transformation-time
2158 messages are included in the "Docutils System Messages" section.
2159 If there are no objections, I can make the change.
2160
2161 The advantage of the current way of doing things is that parse-time
2162 system messages don't require a transform; they're already in the
2163 document. This is valuable for testing (unit tests,
2164 tools/dev/quicktest.py). So if we do decide to make a change, I think
2165 the insertion of parse-time system messages ought to remain as-is
2166 and the Messages transform ought to move all parse-time system
2167 messages (remove from their originally inserted positions, insert in
2168 System Messages section).
2169
2170 * _`Index Generation`
2171
2172
2173 HTML Writer
2174 ===========
2175
2176 * Make the _`list compacting` logic more generic: For example, allow
2177 for literal blocks or line blocks inside of compact list items.
2178
2179 This is not implementable as long as list compacting is done by
2180 omitting ``<p>`` tags. List compacting would need to be done by
2181 adjusting CSS margins instead.
2182
2183 :2015-04-02: The "html5" writer no longer strips <p> tags but adds the
2184 class value ``simple`` to the list.
2185 Formatting is done by CSS --- configurable by a custom style
2186 sheet.
2187
2188 Auto-compactization can be overridden by the ``open`` vs.
2189 ``compact`` class arguments.
2190
2191 * Idea for field-list rendering: hanging indent::
2192
2193 Field name (bold): First paragraph of field body begins
2194 with the field name inline.
2195
2196 If the first item of a field body is not a paragraph,
2197 it would begin on the following line.
2198
2199 :2015-04-02: The "html5" writer writes field-lists as definition lists
2200 with class ``field-list``.
2201 Formatting is done by CSS --- configurable by a custom style
2202 sheet. The default style sheet has some examples, including a
2203 run-in field-list style.
2204
2205 * Add more support for <link> elements, especially for navigation
2206 bars.
2207
2208 The framework does not have a notion of document relationships, so
2209 probably raw.destination_ should be used.
2210
2211 We'll have framework support for document relationships when support
2212 for `multiple output files`_ is added. The HTML writer could
2213 automatically generate <link> elements then.
2214
2215 .. _raw.destination: misc.raw_
2216
2217 * Base list compaction on the spacing of source list? Would require
2218 parser support. (Idea: fantasai, 16 Dec 2002, doc-sig.)
2219
2220 * Add a tool tip ("title" attribute?) to footnote back-links
2221 identifying them as such. Text in Docutils language module.
2222
2223 * Set HTML "width" and "height" attributes with the original size (read
2224 from the image) to prevent *layout shifts*:
2225
2226 Layout shifts are very disrupting to the user, especially if you have
2227 already started reading the article and suddenly you are thrown off
2228 by a jolt of movement, and you have to find your place again.
2229
2230 -- `Setting Height And Width On Images Is Important Again`__
2231
2232 - If there are no size options (``:widht:``, ``:height:``, ``:scale:``)
2233 in the "image" directive and
2234 the image is *local* and can be read and interpreted by PIM.
2235 (if not, silently skip).
2236
2237 - Alternatively, if the only size option is ``:scale: 100%`` and the
2238 image can be read with urllib (*opt-in* for the "costly" variant).
2239
2240 __ https://www.smashingmagazine.com/2020/03/setting-height-width-images-important-again/.
2241
2242
2243 PEP/HTML Writer
2244 ===============
2245
2246 * Remove the generic style information (duplicated from html4css1.css)
2247 from pep.css to avoid redundancy.
2248
2249 Set ``stylesheet-path`` to "html4css.css,pep.css" and the
2250 ``stylesheet-dirs`` accordingly instead. (See the xhtml11 writer for an
2251 example.)
2252
2253
2254 S5/HTML Writer
2255 ==============
2256
2257 * Add a way to begin an untitled slide.
2258
2259 * Add a way to begin a new slide, continuation, using the same title
2260 as the previous slide? (Unnecessary?) You need that if you have a
2261 lot of items in one section which don't fit on one slide.
2262
2263 Maybe either this item or the previous one can be realized using
2264 transitions.
2265
2266 * Have a timeout on incremental items, so the colour goes away after 1
2267 second.
2268
2269 * Add an empty, black last slide (optionally). Currently the handling
2270 of the last slide is not very nice, it re-cycles through the
2271 incremental items on the last slide if you hit space-bar after the
2272 last item.
2273
2274 * Add a command-line option to disable advance-on-click.
2275
2276 * Add a speaker's master document, which would contain a small version
2277 of the slide text with speaker's notes interspersed. The master
2278 document could use ``target="whatever"`` to direct links to a
2279 separate window on a second monitor (e.g., a projector).
2280
2281 .. Note:: This item and the following items are partially
2282 accomplished by the S5 1.2 code (currently in alpha), which has
2283 not yet been integrated into Docutils.
2284
2285 * Speaker's notes -- how to intersperse? Could use reST comments
2286 (".."), but make them visible in the speaker's master document. If
2287 structure is necessary, we could use a "comment" directive (to avoid
2288 nonsensical DTD changes, the "comment" directive could produce an
2289 untitled topic element).
2290
2291 The speaker's notes could (should?) be separate from S5's handout
2292 content.
2293
2294 * The speaker's master document could use frames for easy navigation:
2295 TOC on the left, content on the right.
2296
2297 - It would be nice if clicking in the TOC frame simultaneously
2298 linked to both the speaker's notes frame and to the slide window,
2299 synchronizing both. Needs JavaScript?
2300
2301 - TOC would have to be tightly formatted -- minimal indentation.
2302
2303 - TOC auto-generated, as in the PEP Reader. (What if there already
2304 is a "contents" directive in the document?)
2305
2306 - There could be another frame on the left (top-left or bottom-left)
2307 containing a single "Next" link, always pointing to the next slide
2308 (synchronized, of course). Also "Previous" link? FF/Rew go to
2309 the beginning of the next/current parent section? First/Last
2310 also? Tape-player-style buttons like ``|<< << < > >> >>|``?
2311
2312 Epub/HTML Writer
2313 ================
2314
2315 Add epub as an output format.
2316
2317 epub is an open file format for ebooks based on HTML, specified by the
2318 `International Digital Publishing Forum`_. Thus, documents in epub
2319 format are suited to be read with `electronic reading devices`_.
2320
2321 Pack the output of a HTML writer and supporting files (e.g. images)
2322 into one single epub document.
2323
2324 There are `links to two 3rd party ePub writers`__ in the Docutils link list.
2325 Test and consider moving the better one into the docutils core.
2326
2327 __ ../user/links.html#ePub
2328 .. _International Digital Publishing Forum: http://www.idpf.org/
2329 .. _electronic reading devices:
2330 https://en.wikipedia.org/wiki/List_of_e-book_readers
2331
2332
2333 LaTeX writer
2334 ============
2335
2336 Also see the Problems__ section in the `latex writer documentation`_.
2337
2338 __ ../user/latex.html#problems
2339
2340 .. _latex writer documentation: ../user/latex.html
2341
2342 .. _latex-variants:
2343 ../../../sandbox/latex-variants/README.html
2344
2345
2346 Bug fixes
2347 ---------
2348
2349 * Too deeply nested lists fail: generate a warning and provide
2350 a workaround.
2351
2352 2017-02-09 this is fixed for enumeration in 0.13.1
2353
2354 for others, cf. sandbox/latex-variants/tests/rst-levels.txt
2355
2356 * File names of included graphics (see also `grffile` package).
2357
2358 * Paragraph following field-list or table in compound is indented.
2359
2360 This is a problem with the current DUfieldlist definition and with the
2361 use of "longtable" for tables. See `other LaTeX constructs and packages
2362 instead of re-implementations`_ for alternatives.
2363
2364
2365 Generate clean and configurable LaTeX source
2366 ----------------------------------------------
2367
2368 Which packages do we want to use?
2369
2370 + base and "recommended" packages
2371
2372 (packages that should be in a "reasonably sized and reasonably modern
2373 LaTeX installation like the `texlive-latex-recommended` Debian package,
2374 say):
2375
2376 + No "fancy" or "exotic" requirements.
2377
2378 + pointers to advanced packages and their use in the `latex writer
2379 documentation`_.
2380
2381
2382 Configurable placement of figure and table floats
2383 `````````````````````````````````````````````````
2384
2385 * Special class argument to individually place figures?
2386
2387 Example::
2388
2389 .. figure:: foo.pdf
2390 :class: place-here-if-possible place-top place-bottom
2391
2392 would be written as ``\figure[htb]{...}`` with
2393 the optional args:
2394
2395 :H: place-here
2396 :h: place-here-if-possible
2397 :t: place-top
2398 :b: place-bottom
2399 :p: place-on-extra-page
2400
2401 Alternative: class value = "place-" + optional arg, e.g. ``:class:
2402 place-htb``.
2403
2404 Footnotes
2405 `````````
2406
2407 + True footnotes with LaTeX auto-numbering (as option ``--latex-footnotes``)
2408 (also for target-footnotes):
2409 Write ``\footnote{<footnote content>}`` at the place of the
2410 ``<footnote_reference>`` node.
2411
2412 + Open questions:
2413
2414 - Load hyperref_ with option "hyperfootnotes" and/or
2415 package footnotebackref_ or leave this to the user?
2416
2417 - Consider cases where LaTeX does not support footnotes
2418 (inside tables__, headings__, caption, ...).
2419 Use ftnxtra_, tabularx_, tabulary_, longtable_?
2420
2421 __ http://www.tex.ac.uk/cgi-bin/texfaq2html?label=footintab
2422 __ http://www.tex.ac.uk/cgi-bin/texfaq2html?label=ftnsect
2423
2424 - Consider `multiple footnote refs to common footnote text`__.
2425
2426 KOMA-script classes and the KOMA scrextend_ package provide
2427 ``\footref`` that can be used for additional references to a
2428 ``\label``-ed footnote. Since 2021-05-01, ``\footref`` is provided
2429 by the LaTeX core, too.
2430
2431 __ http://www.tex.ac.uk/cgi-bin/texfaq2html?label=multfoot
2432
2433 - Consider numbered vs. symbolic footnotes.
2434
2435 + document customization (links to how-to and packages)
2436
2437 .. Footnote packages at CTAN (www.ctan.org/pkg/<packagename>):
2438
2439 :footnote: provides a "savenotes" environment which collects all
2440 footnotes and emits them at ``end{savenotes}``
2441 (texlive-latex-recommended)
2442
2443 :ftnxtra_: fixes the issue of footnote inside \caption{},
2444 tabular environment and \section{} like commands.
2445
2446 :footnotebackref_: bidirectional links to/from footnote mark to
2447 footnote text.
2448
2449 .. Footnote Discussion:
2450
2451 `German tutorial
2452 <http://www2.informatik.hu-berlin.de/~ahamann/studies/footnotes.pdf>`__
2453
2454 `wikibooks: footnote workarounds
2455 <https://en.wikibooks.org/wiki/LaTeX/Footnotes_and_Margin_Notes#Common_problems_and_workarounds>`__
2456
2457 .. _footnotebackref: https://www.ctan.org/pkg/footnotebackref
2458 .. _ftnxtra: https://www.ctan.org/pkg/ftnxtra
2459 .. _hyperref: https://www.ctan.org/pkg/hyperref
2460 .. _longtable: https://www.ctan.org/pkg/longtable
2461 .. _scrextend: https://www.ctan.org/pkg/longtable
2462 .. _tabularx: https://www.ctan.org/pkg/tabularx
2463
2464
2465 Other LaTeX constructs and packages instead of re-implementations
2466 `````````````````````````````````````````````````````````````````
2467
2468 * Check the generated source with package `nag`.
2469
2470 * enumitem_ (texlive-latex-extra) for field-lists?
2471
2472 .. _enumitem: https://www.ctan.org/pkg/enumitem
2473
2474
2475 Default layout
2476 --------------
2477
2478 * Use italic instead of slanted for titlereference?
2479
2480 * Start a new paragraph after lists (as currently)
2481 or continue (no blank line in source, no parindent in output)?
2482
2483 Overriding:
2484
2485 * continue if the `compound paragraph`_ directive is used (as currently),
2486 or
2487 * force a new paragraph with an empty comment.
2488
2489 * Sidebar handling (environment with `framed`, `marginnote`, `wrapfig`,
2490 ...)?
2491
2492 * Use optionlist for docinfo?
2493
2494 * Keep literal-blocks together on a page, avoid pagebreaks.
2495
2496 Failed experiments up to now: samepage, minipage, pagebreak 1 to 4 before
2497 the block.
2498
2499 Should be possible with ``--literal-block-env==lstlistings`` and some
2500 configuration...
2501
2502 * More space between title and subtitle? ::
2503
2504 - \\ % subtitle%
2505 + \\[0.5em] % subtitle%
2506
2507 .. _compound paragraph:
2508 ../ref/rst/directives.html#compound-paragraph
2509
2510
2511 Tables
2512 ``````
2513
2514 * Improve/simplify logic to set the column width in the output.
2515
2516 + Assumed reST line length for table width setting configurable, or
2517 + use `ltxtable` (a combination of `tabularx` (auto-width) and
2518 `longtable` (page breaks)), or
2519 + use tabularx column type ``X`` and let LaTeX decide width, or
2520 + use tabulary_?
2521
2522 .. _tabulary: https://www.ctan.org/pkg/tabulary
2523
2524 * From comp.text.tex (13. 4. 2011):
2525
2526 When using fixed width columns, you should ensure that the total
2527 width does not exceed \linewidth: if the first column is p{6cm}
2528 the second one should be p{\dimexpr\linewidth-6cm-4\tabcolsep}
2529 because the glue \tabcolsep is added twice at every column edge.
2530 You may also consider to set \tabcolsep to a different value...
2531
2532 * csv-tables do not have a colwidth.
2533
2534 * Add more classes or options, e.g. for
2535
2536 + horizontal alignment and rules.
2537 + long table vs. tabular (see next item).
2538
2539 * Use tabular instead of longtable for tables in legends or generally
2540 inside a float?
2541
2542 Alternatively, default to tabular and use longtable only if specified
2543 by config setting or class argument (analogue to booktable)?
2544
2545 * Table heads and footer for longtable (firstpage lastpage ..)?
2546
2547 * In tools.rst the option tables right column, there should be some more
2548 spacing between the description and the next paragraph "Default:".
2549
2550 * Paragraph separation in tables is hairy.
2551 see http://www.tex.ac.uk/cgi-bin/texfaq2html?label=struttab
2552
2553 - The strut solution did not work.
2554 - setting extrarowheight added ad top of row not between paragraphs in
2555 a cell. ALTHOUGH i set it to 2pt because, text is too close to the topline.
2556 - baselineskip/stretch does not help.
2557
2558 * Should there be two hlines after table head and on table end?
2559
2560 * Place titled tables in a float ('table' environment)?
2561
2562 The 'table', 'csv-table', and 'list-table' directives support an (optional)
2563 table title. In analogy to the 'figure' directive this should map to a
2564 table float.
2565
2566
2567 Image and figure directives
2568 ```````````````````````````
2569
2570 * compare the test case in:
2571
2572 + `<../../test/functional/input/data/standard.rst>`__
2573 + `<../../test/functional/expected/standalone_rst_html4css1.html>`__
2574 + `<../../test/functional/expected/standalone_rst_latex.tex>`__
2575
2576 * The default CSS styling for HTML output (plain.css, default.css) lets
2577 text following a right- or left-aligned image float to the side of the
2578 image/figure.
2579
2580 + Use this default also for LaTeX?
2581
2582 + Wrap text around figures/images with class argument "wrap"
2583 (like the odt writer)?
2584
2585 Use `wrapfig` (or other recommended) package.
2586
2587 * support more graphic formats (especially SVG, the only standard
2588 vector format for HTML)
2589
2590
2591 Missing features
2592 ----------------
2593
2594 * support "figwidth" argument for figures.
2595
2596 As the 'figwidth' argument is still ignored and the "natural width" of
2597 a figure in LaTeX is 100 % of the text width, setting the 'align'
2598 argument has currently no effect on the LaTeX output.
2599
2600 * Consider supporting the "compact" option and class argument (from
2601 rst2html) as some lists look better compact and others need the space.
2602
2603 * Better citation support
2604 (see `Footnote & Citation Gathering`_).
2605
2606 * If ``use-latex-citations`` is used, a bibliography is inserted right at the
2607 end of the document.
2608
2609 Put in place of the to-be-implemented "citations" directive
2610 (see `Footnote & Citation Gathering`_).
2611
2612
2613 Unicode to LaTeX
2614 ````````````````
2615
2616 The `LyX <http://www.lyx.org>`_ document processor has a comprehensive
2617 Unicode to LaTeX conversion feature with a file called ``unicodesymbols``
2618 that lists LaTeX counterparts for a wide range of Unicode characters.
2619
2620 * Use this in the LaTeXTranslator?
2621 Think of copyright issues!
2622
2623 * The "ucs" package has many translations in ...doc/latex/ucs/config/
2624
2625 * The bibstuff_ tool ships a `latex_codec` Python module!
2626
2627 .. _bibstuff: http://code.google.com/p/bibstuff/
2628
2629
2630 XeTeX writer
2631 ````````````
2632
2633 * Glyphs missing in the font are left out in the PDF without warning
2634 (e.g. ⇔ left-right double arrow in the functional test output).
2635
2636 * Disable word-wrap (hyphenation) in literal text locally with
2637 ``providecommand{\nohyphenation}{\addfontfeatures{HyphenChar=None}}``?
2638
2639
2640 problematic URLs
2641 ````````````````
2642
2643 * ^^ LaTeX's special syntax for characters results in "strange" replacements
2644 (both with \href and \url).
2645
2646 `file with ^^ <../strange^^name>`__:
2647 `<../strange^^name>`__
2648
2649 * Unbalanced braces, { or }, will fail (both with \href and \url)::
2650
2651 `file with { <../strange{name>`__
2652 `<../strange{name>`__
2653
2654 Currently, a warning is written to the error output stream.
2655
2656 For correct printing, we can
2657
2658 * use the \href command with "normal" escaped name argument, or
2659 * define a url-command in the preamble ::
2660
2661 \urldef{\fragileURLi}\nolinkurl{myself%[email protected]}
2662
2663 but need to find a way to insert it as href argument.
2664
2665 The following fails::
2666
2667 \href{https://www.w3.org/XML/Schema^^dev}{\fragileURLi}
2668
2669 Use %-replacement like http://nowhere/url_with%28parens%29 ?
2670
2671 -> does not work for file paths (with pdflatex and xpdf).
2672
2673
2674 add-stylesheet option
2675 `````````````````````
2676
2677 From http://article.gmane.org/gmane.text.docutils.devel/3429/
2678
2679 The problem is that since we have a default value, we have to
2680 differentiate between adding another stylesheet and replacing the
2681 default. I suggest that the existing --stylesheet & --stylesheet-path
2682 options keep their semantics to replace the existing settings. We
2683 could introduce new --add-stylesheet & --add-stylesheet-path options,
2684 which accumulate; further --stylesheet/--stylesheet-path options would
2685 clear these lists. The stylesheet or stylesheet_path setting (only
2686 one may be set), plus the added_stylesheets and added_stylesheet_paths
2687 settings, describe the combined styles.
2688
2689 For example, this run will have only one custom stylesheet:
2690
2691 rstpep2html.py --stylesheet-path custom.css ...
2692
2693 This run will use the default stylesheet, and the custom one:
2694
2695 rstpep2html.py --add-stylesheet-path custom.css ...
2696
2697 This run will use the default stylesheet, a custom local stylesheet,
2698 and an external stylesheet:
2699
2700 rstpep2html.py --add-stylesheet-path custom.css \
2701 --add-stylesheet https://www.example.org/external.css ...
2702
2703 This run will use only the second custom stylesheet:
2704
2705 rstpep2html.py --add-stylesheet-path custom.css \
2706 --stylesheet-path second.css ...
2707
2708
2709 Front-End Tools
2710 ===============
2711
2712 * Parameterize help text & defaults somehow? Perhaps a callback? Or
2713 initialize ``settings_spec`` in ``__init__`` or ``init_options``?
2714
2715 * Disable common options that don't apply?
2716
2717 * Implement the following suggestion from clig.dev?
2718
2719 Display output on success, but keep it brief.
2720 provide a --quiet option to suppress all non-essential output.
2721
2722 -- https://clig.dev/#help
2723
2724 .. _partial parsing:
2725 https://docs.python.org/3/library/argparse.html#partial-parsing
2726
2727 .. _configuration: ../user/config.html
2728 .. _transforms: ../api/transforms.html
2729
2730
2731 .. Emacs settings
2732
2733 Local Variables:
2734 mode: indented-text
2735 mode: rst
2736 indent-tabs-mode: nil
2737 sentence-end-double-space: t
2738 fill-column: 70
2739 End: