public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFC: Experimental use of Sphinx for GCC documentation
@ 2015-11-08 13:55 David Malcolm
  2015-11-08 15:16 ` Arnaud Charlet
                   ` (4 more replies)
  0 siblings, 5 replies; 128+ messages in thread
From: David Malcolm @ 2015-11-08 13:55 UTC (permalink / raw)
  To: gcc-patches

I've been experimenting with using Sphinx [1] for GCC's documentation.

You can see an HTML sample of GCC docs built with Sphinx here:
https://dmalcolm.fedorapeople.org/gcc/2015-08-31/rst-experiment/gcc.html
(it's a work-in-progress; i.e. there are bugs).

Compare with:
 https://gcc.gnu.org/onlinedocs/gcc/index.html


In particular, note how options get stable, clickable URLs:
https://dmalcolm.fedorapeople.org/gcc/2015-08-31/rst-experiment/option-summary.html

as compared to:
https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html#Option-Summary


Example of an option URL, for "-ftree-loop-if-convert-stores" (also
showing syntax-highlighted example code):
https://dmalcolm.fedorapeople.org/gcc/2015-08-31/rst-experiment/options-that-control-optimization.html#cmdoption-ftree-loop-if-convert-stores

as compared to:
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-ftree-loop-if-convert-1054 (where I had to use via "View Source" to find that URL, and what's up with that "-1054" wart? note also that the number can change, making the URL unstable)


Example of a stable URL for "What does -O2 do?":
https://dmalcolm.fedorapeople.org/gcc/2015-08-31/rst-experiment/options-that-control-optimization.html#cmdoption-O2

...etc


Every HTML page also gets a "Show Source" link, showing the input
markup.


Sphinx is a modern, well-maintained documentation toolchain, implemented
in Python.  The input format is an easy minimal-markup "semantic"
format; the output is high-quality HTML, with PDF and texinfo supported
amongst other output formats.   It was created for documenting the
Python programming language, and is in use by many FLOSS projects for
their docs, including e.g. LLVM (http://llvm.org/docs/).  See also:
http://sphinx-doc.org/examples.html (though this list is far from
complete).   It's BSD-licensed.

We are currently using Sphinx for libgccjit:
  https://gcc.gnu.org/onlinedocs/jit/index.html
and, I believe, for Ada:
https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn.html [2]

I've also used it for generating slides for Cauldron presentations:
https://dmalcolm.fedorapeople.org/presentations/cauldron-2014/rtl/
https://dmalcolm.fedorapeople.org/presentations/cauldron-2014/jit/

and for gcc-python-plugin:
 https://gcc-python-plugin.readthedocs.org/en/latest/



I've written a tool called texi2rst which attempts to convert a .texi
based document to .rst ("restructured text", the input format for
Sphinx):
 https://github.com/davidmalcolm/texi2rst

This is what generated the examples above.

It doesn't *quite* do a direct .texi to .rst conversion yet: it can take
the XML output from texinfo's "makeinfo --xml", and generate either one
big .rst file, or a group of smaller .rst files.

My hope was that for every gcc/docs/foo.texi file we have, my tool would
be able to generate a gcc/docs/foo.rst (maybe retaining the name, to
allow for sane diff and hence sane patch review).

Unfortunately, "makeinfo --xml" resolves includes and conditional
processing, so the underlying input structure of .texinfo files is lost
at that point.

To fix that, I've been working on a frontend from texi2rst that
re-implements the .texi to xml processing, retaining information on
includes, and directives, so that I can translate them to
corresponding .rst directives.  Unfortunately it's clear that I'm not
going to finish that before stage 1 closes - but I think it's feasible
in the stage3 timeframe.

Hence in the example posted above, the doc is split into pages based on
nodes, named after the nodes, and thus get rather long names e.g.
options-that-control-optimization.html, generated from
options-that-control-optimization.rst.  In a more polished version,
these names would be saner.

The primary advantages of .rst/sphinx over .texi/texinfo I see are in
the generated HTML:

* sane, stable URLs (so e.g. there is a reliable URL for the docs for,
say, "-Wall").

* a page-splitting structure that make sense, to me, at least [3]

* much more use of markup, with restrained and well-chosen CSS
(texinfo's HTML seems to ignore much of the inline markup in
the .texinfo file)

* autogenerated internal links, so that almost everything is clickable,
and will take you somewhere sane, by default

* syntax-highlighting of code examples, with support for multiple
programming languages (note the mixture of C, C++, Fortran, etc in the
docs for the gcc options).

* looks modern and fresh (IMHO), letting casual observers see that the
project is alive and kicking.


Thoughts?
Dave

[1] http://sphinx-doc.org/
[2] I couldn't find Sphinx-built HTML for Ada on the gcc website, just
the Texinfo output here:
https://gcc.gnu.org/onlinedocs/gnat_ugn/index.html
[3] I have never fathomed the way texinfo's navigation works, for HTML,
at least, and I believe I'm not the only one; I generally pick the
all-in-one-HTML-page option when viewing texinfo-html docs and do
textual searches, since otherwise I usually can't find the thing I'm
looking for (or have to resort to a brute-force depth-first search of
clicking through the links).

^ permalink raw reply	[flat|nested] 128+ messages in thread

end of thread, other threads:[~2021-08-27  9:31 UTC | newest]

Thread overview: 128+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-08 13:55 RFC: Experimental use of Sphinx for GCC documentation David Malcolm
2015-11-08 15:16 ` Arnaud Charlet
2015-11-09 19:22   ` David Malcolm
2015-11-09 19:39     ` Arnaud Charlet
2015-11-09 20:33       ` Arnaud Charlet
2015-11-09 16:54 ` Kyrill Tkachov
2015-11-09 19:20   ` David Malcolm
2015-11-09 23:37 ` Sandra Loosemore
2015-11-10 22:27   ` David Malcolm
2015-11-11  3:02     ` Sandra Loosemore
2015-11-10 23:06   ` Joseph Myers
2015-11-10  0:14 ` Joseph Myers
2021-04-01 13:30 ` RFC: " Martin Liška
2021-04-01 13:42   ` Koning, Paul
2021-04-01 13:51     ` Martin Liška
2021-04-01 13:56       ` Koning, Paul
2021-04-01 14:08   ` Marek Polacek
2021-04-01 14:31   ` David Malcolm
2021-04-07 14:17     ` Martin Liška
2021-04-01 14:47   ` Koning, Paul
2021-04-02 15:40   ` Martin Sebor
2021-04-02 20:16     ` Koning, Paul
2021-04-07 14:25     ` Martin Liška
2021-04-07 15:32       ` Michael Matz
2021-04-07 17:40         ` Joseph Myers
2021-05-13 10:28           ` Martin Liška
2021-05-13 11:45   ` Martin Liška
2021-05-31 13:25     ` GCC documentation: porting to Sphinx Martin Liška
2021-05-31 15:49       ` Michael Matz
2021-06-01  7:31         ` Martin Liška
2021-06-01 13:31           ` Michael Matz
2021-06-02  7:36             ` Martin Liška
2021-06-02 16:05               ` Joel Sherrill
2021-06-02 16:44                 ` Joseph Myers
2021-06-03 12:26                   ` Martin Liška
2021-06-03 17:16                     ` Joseph Myers
2021-06-04  7:27                       ` Martin Liška
2021-06-02 17:27       ` Joseph Myers
2021-06-10 14:06         ` Martin Liška
2021-06-10 16:49           ` Joseph Myers
2021-06-11 14:33             ` Martin Liška
2021-06-11 15:50               ` Joseph Myers
2021-06-11 18:48                 ` Koning, Paul
2021-06-23 13:13                 ` Martin Liška
2021-06-23 16:00                   ` Joseph Myers
2021-06-24 14:08                     ` Martin Liška
2021-06-25 13:11                       ` Martin Liška
2021-06-25 13:14                         ` Martin Liška
2021-06-28 10:23                         ` Arnaud Charlet
2021-06-28 10:44                           ` Martin Liška
2021-06-29 15:54                             ` Arnaud Charlet
2021-06-30  7:52                               ` Martin Liška
2021-08-10 15:43                                 ` Martin Liška
2021-08-27  9:31                                   ` Martin Liška
2021-06-28 12:01                         ` [PATCH] Port GCC documentation " Martin Liška
2021-06-28 15:33                           ` Joseph Myers
2021-06-29 10:09                             ` Martin Liška
2021-06-29 10:50                               ` Richard Earnshaw
2021-06-30  4:47                                 ` Martin Liška
2021-06-30 10:14                                   ` Richard Earnshaw
2021-06-30 11:58                                     ` Martin Liška
2021-06-29 16:57                               ` Eli Zaretskii
2021-06-29 18:01                                 ` Eli Zaretskii
2021-06-30 10:11                                 ` Martin Liška
2021-06-30 10:46                                   ` Martin Liška
2021-06-30 13:09                                   ` Eli Zaretskii
2021-07-01 12:44                                     ` Martin Liška
2021-07-01 13:33                                       ` Eli Zaretskii
2021-07-01 14:14                                         ` Martin Liška
2021-07-01 15:06                                           ` Michael Matz
2021-07-02  9:40                                             ` Martin Liška
2021-07-02 10:32                                               ` Eli Zaretskii
2021-07-01 15:44                                           ` Eli Zaretskii
2021-07-01 16:04                                             ` Martin Liška
2021-07-01 16:58                                               ` Eli Zaretskii
2021-07-02  9:30                                                 ` Martin Liška
2021-07-02 10:31                                                   ` Eli Zaretskii
2021-07-02 13:23                                                     ` Martin Liška
2021-07-02 23:53                                     ` Hans-Peter Nilsson
2021-07-05  9:17                                       ` Richard Sandiford
2021-07-05 12:14                                         ` Eli Zaretskii
2021-07-05 13:03                                           ` Richard Sandiford
2021-07-12 13:25                                       ` Benefits of using Sphinx documentation format Martin Liška
2021-07-12 13:39                                         ` Eli Zaretskii
2021-07-12 13:53                                           ` Jonathan Wakely
2021-07-12 14:05                                             ` Jonathan Wakely
2021-07-12 14:16                                               ` Eli Zaretskii
2021-07-12 14:34                                                 ` Martin Liška
2021-07-12 17:09                                                   ` Eli Zaretskii
2021-07-12 14:12                                             ` Eli Zaretskii
2021-07-12 14:30                                               ` Martin Liška
2021-07-12 14:52                                               ` Jonathan Wakely
2021-07-12 14:54                                                 ` Jonathan Wakely
2021-07-12 17:14                                                   ` Eli Zaretskii
2021-07-12 15:03                                                 ` Jonathan Wakely
2021-07-12 16:00                                                   ` Gavin Smith
2021-07-12 16:15                                                     ` Jonathan Wakely
2021-07-12 14:37                                           ` Martin Liška
2021-07-12 17:12                                             ` Eli Zaretskii
2021-07-12 16:36                                         ` David Malcolm
2021-07-12 18:23                                           ` Koning, Paul
2021-06-30 12:26                                 ` [PATCH] Port GCC documentation to Sphinx Martin Liška
2021-06-30 13:28                                 ` Martin Liška
2021-06-30 13:38                                   ` Eli Zaretskii
2021-06-30 14:04                                     ` Martin Liška
2021-06-30 15:43                                       ` Eli Zaretskii
2021-07-01 12:31                                         ` Martin Liška
2021-06-30 10:55                               ` Andrey Belevantsev
2021-06-30 12:42                                 ` Martin Liška
2021-07-12 17:18                               ` Martin Sebor
2021-08-09 12:18                                 ` Martin Liška
2021-07-13 14:54                               ` Tamar Christina
2021-08-09 13:29                                 ` Martin Liška
2021-06-02 20:41       ` GCC documentation: porting " Martin Sebor
2021-06-03 10:56         ` Martin Liška
2021-06-04 15:10           ` Martin Sebor
2021-06-10  9:07             ` Martin Liška
2021-06-10 13:18               ` Martin Liška
2021-06-10 23:48                 ` Martin Sebor
2021-06-11 14:34                   ` Martin Liška
2021-06-04  7:55     ` RFC: Sphinx for GCC documentation Tobias Burnus
2021-06-04 14:24       ` Koning, Paul
2021-06-07 13:30         ` Martin Liška
2021-06-07 21:26           ` Bernhard Reutner-Fischer
2021-06-08  7:43             ` Martin Liška
2021-06-07 13:28       ` Martin Liška
2021-06-07 14:19         ` Tobias Burnus
2021-06-10 10:32           ` Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).