~ubuntu-branches/ubuntu/jaunty/python-docutils/jaunty

« back to all changes in this revision

Viewing changes to FAQ.txt

  • Committer: Bazaar Package Importer
  • Author(s): Simon McVittie
  • Date: 2008-07-24 10:39:53 UTC
  • mfrom: (1.1.4 upstream) (3.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080724103953-8gh4uezg17g9ysgy
Tags: 0.5-2
* Upload docutils 0.5 to unstable
* Update rst.el to upstream Subversion r5596, which apparently fixes
  all its performance problems (17_speed_up_rst_el.dpatch, closes: #474941)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
.. -*- coding: utf-8 -*-
2
2
 
 
3
 
 
4
.. NOTE TO MAINTAINERS: Please add new questions to the end of their
 
5
   sections, so section/question numbers remain stable.
 
6
 
 
7
 
3
8
===========================================
4
9
 Docutils FAQ (Frequently Asked Questions)
5
10
===========================================
6
11
 
7
 
:Date: $Date: 2005-12-09 05:21:34 +0100 (Fri, 09 Dec 2005) $
8
 
:Revision: $Revision: 4163 $
 
12
:Date: $Date: 2008-01-05 03:23:54 +0100 (Sam, 05 Jän 2008) $
 
13
:Revision: $Revision: 5495 $
9
14
:Web site: http://docutils.sourceforge.net/
10
15
:Copyright: This document has been placed in the public domain.
11
16
 
13
18
.. sectnum::
14
19
 
15
20
 
16
 
This is a work in progress.  Please feel free to ask questions and/or
17
 
provide answers; send email to the `Docutils-users`_ mailing list.
18
 
Project members should feel free to edit the source text file
19
 
directly.
20
 
 
 
21
This is a work in progress.  If you are reading a local copy, the
 
22
`master copy`_ might be newer.  This document uses are relative links;
 
23
if they don't work, please use the `master copy`_.
 
24
 
 
25
Please feel free to ask questions and/or provide answers; send email
 
26
to the `Docutils-users`_ mailing list.  Project members should feel
 
27
free to edit the source text file directly.
 
28
 
 
29
.. _master copy: http://docutils.sourceforge.net/FAQ.html
21
30
.. _let us know:
22
31
.. _Docutils-users: docs/user/mailing-lists.html#docutils-users
23
32
 
24
33
 
 
34
 
25
35
Docutils
26
36
========
27
37
 
35
45
`PEPs (Python Enhancement Proposals)`_ (implemented), and others as
36
46
discovered.
37
47
 
 
48
The Docutils distribution consists of:
 
49
 
 
50
* a library (the "docutils" package), which `can be used by client
 
51
  code`_;
 
52
* several `front-end tools`_ (such as ``rst2html.py``, which converts
 
53
  reStructuredText input into HTML output);
 
54
* a `test suite`_; and
 
55
* extensive documentation_.
 
56
 
38
57
For an overview of the Docutils project implementation, see `PEP
39
58
258`_, "Docutils Design Specification".
40
59
 
43
62
.. _Docutils: http://docutils.sourceforge.net/
44
63
.. _PEPs (Python Enhancement Proposals):
45
64
   http://www.python.org/peps/pep-0012.html
 
65
.. _can be used by client code: docs/api/publisher.html
 
66
.. _front-end tools: docs/user/tools.html
 
67
.. _test suite: docs/dev/testing.html
 
68
.. _documentation: docs/index.html
46
69
.. _PEP 258: http://www.python.org/peps/pep-0258.html
47
70
.. _Python: http://www.python.org/
48
71
 
72
95
Introduction to reStructuredText`_.
73
96
 
74
97
Please note that the name is "Docutils", not "DocUtils" or "Doc-Utils"
75
 
or any other variation.
 
98
or any other variation.  It is pronounced as in "DOCumentation
 
99
UTILitieS", with emphasis on the first syllable.
76
100
 
77
 
.. _An Introduction to reStructuredText:
78
 
   http://docutils.sourceforge.net/docs/ref/rst/introduction.html
 
101
.. _An Introduction to reStructuredText: docs/ref/rst/introduction.html
79
102
__ http://mail.python.org/pipermail/doc-sig/1999-December/000878.html
80
103
__ http://mail.python.org/pipermail/doc-sig/2000-November/001252.html
81
104
__ http://mail.python.org/pipermail/doc-sig/2000-November/001239.html
136
159
reference are a good place to start.  The `reStructuredText Markup
137
160
Specification`_ is a detailed technical specification.
138
161
 
139
 
.. _A ReStructuredText Primer:
140
 
   http://docutils.sourceforge.net/docs/user/rst/quickstart.html
141
 
.. _Quick reStructuredText:
142
 
   http://docutils.sourceforge.net/docs/user/rst/quickref.html
 
162
.. _A ReStructuredText Primer: docs/user/rst/quickstart.html
 
163
.. _Quick reStructuredText: docs/user/rst/quickref.html
143
164
.. _reStructuredText Markup Specification:
144
 
   http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
 
165
   docs/ref/rst/restructuredtext.html
145
166
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
146
167
.. _StructuredText:
147
168
   http://dev.zope.org/Members/jim/StructuredTextWiki/FrontPage/
182
203
require that users alter their OS settings, which is something that
183
204
many users will not be willing or able to do.
184
205
 
 
206
Also see `What's the official MIME type for reStructuredText data?`_
 
207
 
185
208
 
186
209
Are there any reStructuredText editor extensions?
187
210
-------------------------------------------------
188
211
 
189
212
See `Editor Support for reStructuredText`__.
190
213
 
191
 
__ http://docutils.sf.net/tools/editors/README.html
 
214
__ tools/editors/README.html
192
215
 
193
216
 
194
217
How can I indicate the document title?  Subtitle?
243
266
Emacs users should refer to the `Emacs Support for reStructuredText`__
244
267
document.  Tips for other editors are welcome.
245
268
 
246
 
__ http://docutils.sourceforge.net/tools/editors/emacs/README.html
 
269
__ tools/editors/emacs/README.html
247
270
 
248
271
ReStructuredText has no character entity subsystem; it doesn't know
249
272
anything about XML charents.  To Docutils, "—" in input text is
293
316
thus you need to add spaces ("``foo |---| bar``") and advise the
294
317
reStructuredText parser to trim the spaces.
295
318
 
296
 
.. _Standard Substitution Definition Sets:
297
 
   http://docutils.sf.net/docs/ref/rst/substitutions.html
298
 
.. _unicode:
299
 
   http://docutils.sf.net/docs/ref/rst/directives.html#unicode-character-codes
 
319
.. _Standard Substitution Definition Sets: docs/ref/rst/substitutions.html
 
320
.. _unicode: docs/ref/rst/directives.html#unicode-character-codes
300
321
.. _are available: http://docutils.sourceforge.net/tmp/charents/
301
322
.. _tarball: http://docutils.sourceforge.net/tmp/charents.tgz
302
323
.. _description and instructions:
303
324
   http://docutils.sourceforge.net/tmp/charents/README.html
304
 
.. _to-do list: http://docutils.sourceforge.net/docs/dev/todo.html
 
325
.. _to-do list: docs/dev/todo.html
305
326
 
306
327
 
307
328
How can I generate backticks using a Scandinavian keyboard?
386
407
 
387
408
* `Webware for Python wiki
388
409
  <http://wiki.webwareforpython.org/thiswiki.html>`__
 
410
 
389
411
* `Ian Bicking's experimental code
390
412
  <http://docutils.sf.net/sandbox/ianb/wiki/Wiki.py>`__
 
413
 
391
414
* `MoinMoin <http://moinmoin.wikiwikiweb.de/>`__ has some support;
392
415
  `here's a sample <http://moinmoin.wikiwikiweb.de/RestSample>`__
 
416
 
393
417
* Zope-based `Zwiki <http://zwiki.org/>`__
394
 
* Zope3-based Zwiki (in the Zope 3 source tree as ``zope.products.zwiki``)
 
418
 
 
419
* Zope3-based Zwiki (in the Zope 3 source tree as
 
420
  ``zope.products.zwiki``)
 
421
 
395
422
* `StikiWiki <http://mithrandr.moria.org/code/stikiwiki/>`__
396
 
* `Trac <http://projects.edgewall.com/trac/>`__ `supports using reStructuredText
397
 
  <http://projects.edgewall.com/trac/wiki/WikiRestructuredText>`__ as an
398
 
  alternative to wiki markup. This includes support for `TracLinks
399
 
  <http://projects.edgewall.com/trac/wiki/TracLinks>`__ from within RST
400
 
  text via a custom RST reference-directive or, even easier, an interpreted text
401
 
  role 'trac'
402
 
* `Vogontia <http://www.ososo.de/vogontia/>`__, a Wiki-like FAQ system
 
423
 
 
424
* `Trac <http://projects.edgewall.com/trac/>`__ `supports using
 
425
  reStructuredText
 
426
  <http://projects.edgewall.com/trac/wiki/WikiRestructuredText>`__ as
 
427
  an alternative to wiki markup. This includes support for `TracLinks
 
428
  <http://projects.edgewall.com/trac/wiki/TracLinks>`__ from within
 
429
  RST text via a custom RST reference-directive or, even easier, an
 
430
  interpreted text role 'trac'
403
431
 
404
432
Please `let us know`_ of any other reStructuredText Wikis.
405
433
 
416
444
 
417
445
* `Firedrop <http://www.voidspace.org.uk/python/firedrop2/>`__
418
446
* `Python Desktop Server <http://pyds.muensterland.org/>`__
419
 
* `PyBloxsom <http://roughingit.subtlehints.net/pyblosxom/>`__
 
447
* `PyBloxsom <http://pyblosxom.sourceforge.net/>`__
420
448
* `Lino WebMan <http://lino.sourceforge.net/webman.html>`__
421
449
 
422
450
Please `let us know`_ of any other reStructuredText Blogs.
423
451
 
424
452
 
425
 
Can lists be indented without generating block quotes?
426
 
------------------------------------------------------
427
 
 
428
 
Some people like to write lists with indentation, without intending a
429
 
block quote context, like this::
430
 
 
431
 
    paragraph
432
 
 
433
 
      * list item 1
434
 
      * list item 2
435
 
 
436
 
There has been a lot of discussion about this, but there are some
437
 
issues that would need to be resolved before it could be implemented.
438
 
There is a summary of the issues and pointers to the discussions in
439
 
`the to-do list`__.
440
 
 
441
 
__ http://docutils.sourceforge.net/docs/dev/todo.html#indented-lists
 
453
.. _Can lists be indented without generating block quotes?:
 
454
 
 
455
How should I mark up lists?
 
456
---------------------------
 
457
 
 
458
Bullet_ & enumerated_ list markup is very intuitive but there are 2
 
459
points that must be noted:
 
460
 
 
461
.. _bullet: docs/ref/rst/restructuredtext.html#bullet-lists
 
462
.. _enumerated: docs/ref/rst/restructuredtext.html#enumerated-lists
 
463
 
 
464
1. Lists should **not** be indented.  This is correct::
 
465
 
 
466
       paragraph
 
467
 
 
468
       * list item 1
 
469
 
 
470
         * nested item 1.1
 
471
         * nested item 1.2
 
472
 
 
473
       * list item 2
 
474
 
 
475
   while this is probably incorrect::
 
476
 
 
477
       paragraph
 
478
 
 
479
         * list item 1
 
480
 
 
481
             * nested item 1.1
 
482
             * nested item 1.2
 
483
 
 
484
         * list item 2
 
485
 
 
486
   The extra indentation (of the list containing items 1.1 and 1.2) is
 
487
   recognized as a block quote.  This is usually not what you mean and
 
488
   it causes the list in the output to be indented too much.
 
489
 
 
490
2. There **must** be blank lines around list items, except between
 
491
   items of the same level, where blank lines are optional.  The
 
492
   example above shows this.
 
493
 
 
494
Note that formatting of the *output* is independent of the input, and
 
495
is decided by the writer and the stylesheet.  For instance, lists
 
496
*are* indented in HTML output by default.  See `How are lists
 
497
formatted in HTML?`_ for details.
 
498
 
 
499
 
 
500
Could lists be indented without generating block quotes?
 
501
--------------------------------------------------------
 
502
 
 
503
Some people like to write lists with indentation but don't intend a
 
504
blockquote context.  There has been a lot of discussion about allowing
 
505
this in reStructuredText, but there are some issues that would need to
 
506
be resolved before it could be implemented.  There is a summary of the
 
507
issues and pointers to the discussions in `the to-do list`__.
 
508
 
 
509
__ docs/dev/todo.html#indented-lists
442
510
 
443
511
 
444
512
Could the requirement for blank lines around lists be relaxed?
465
533
technical and aesthetic issues and implement a generic solution.
466
534
Here's the `to-do list entry`__.
467
535
 
468
 
__ http://docutils.sourceforge.net/docs/dev/todo.html#math-markup
 
536
__ docs/dev/todo.html#math-markup
469
537
 
470
538
There are several quick & dirty ways to include equations in documents.
471
539
They all presently use LaTeX syntax or dialects of it.
488
556
 
489
557
      the binomial expansion of :raw-latex:`$(x+a)^3$` is
490
558
 
491
 
  .. _raw directive: http://docutils.sourceforge.net/docs/ref/rst/
492
 
                     directives.html#raw-data-pass-through
493
 
  .. _raw role: http://docutils.sourceforge.net/docs/ref/rst/roles.html#raw
 
559
  .. _raw directive: docs/ref/rst/directives.html#raw-data-pass-through
 
560
  .. _raw role: docs/ref/rst/roles.html#raw
494
561
 
495
562
* Jens Jørgen Mortensen has implemented a "latex-math" role and
496
563
  directive, available from `his sandbox`__.
544
611
    Here is some *emphasized text containing a `hyperlink`_ and
545
612
    ``inline literals``*.
546
613
 
547
 
__ http://docutils.sf.net/docs/dev/todo.html#nested-inline-markup
548
 
__ http://docutils.sf.net/docs/dev/rst/alternatives.html#nested-inline-markup
 
614
__ docs/dev/todo.html#nested-inline-markup
 
615
__ docs/dev/rst/alternatives.html#nested-inline-markup
549
616
 
550
617
There are workarounds, but they are either convoluted or ugly or both.
551
618
They are not recommended.
562
629
  It is not possible for just a portion of the replacement text to be
563
630
  a hyperlink; it's the entire replacement text or nothing.
564
631
 
565
 
  __ http://docutils.sf.net/docs/ref/rst/restructuredtext.html#substitution-definitions
566
 
  __ http://docutils.sf.net/docs/ref/rst/restructuredtext.html#substitution-references
567
 
  __ http://docutils.sf.net/docs/ref/rst/directives.html#replace
 
632
  __ docs/ref/rst/restructuredtext.html#substitution-definitions
 
633
  __ docs/ref/rst/restructuredtext.html#substitution-references
 
634
  __ docs/ref/rst/directives.html#replace
568
635
 
569
636
* The `"raw" directive`__ can be used to insert raw HTML into HTML
570
637
  output::
579
646
 
580
647
  Raw LaTeX is supported for LaTeX output, etc.
581
648
 
582
 
  __ http://docutils.sf.net/docs/ref/rst/directives.html#raw
 
649
  __ docs/ref/rst/directives.html#raw
583
650
 
584
651
 
585
652
How to indicate a line break or a significant newline?
604
671
    |
605
672
    | Singing...
606
673
 
607
 
__ http://docutils.sf.net/docs/ref/rst/restructuredtext.html#line-blocks
 
674
__ docs/ref/rst/restructuredtext.html#line-blocks
608
675
 
609
676
Here's a workaround for manually inserting explicit line breaks in
610
677
HTML output::
745
812
       :A: Answer.
746
813
 
747
814
 
 
815
.. _bidi:
 
816
 
 
817
Can I produce documents in right-to-left languages?
 
818
---------------------------------------------------
 
819
 
 
820
Languages written from right to left, such as Arabic and Hebrew, must
 
821
be reordered according to the `Unicode Bidi Algorithm`_.  This
 
822
requires support from the editor and special markup in the output
 
823
format.
 
824
 
 
825
The source format of reStructuredText is relatively bidi-friendly:
 
826
most constructs are denoted by punctuation without intrusion of
 
827
English and when you must write in English, it's usually on a separate
 
828
line.  So any editor that auto-detects direction per-line (like gedit
 
829
or geresh_) will suffice.
 
830
 
 
831
Moreover, it's possible to translate_ all reStructuredText keywords.
 
832
This was not yet done for any RTL language, but when it is, it will be
 
833
possible to write an RTL document with vitually no English.  This will
 
834
allow reasonable use of editors limited to a single base direction for
 
835
the whole document (like Notepad, Vim and text boxes in Firefox).
 
836
 
 
837
.. _Unicode Bidi Algorithm: http://www.unicode.org/reports/tr9/
 
838
.. _geresh: http://www.typo.co.il/~mooffie/geresh/
 
839
.. _translate: docs/howto/i18n.html
 
840
 
 
841
The second problem is bidi markup of the output.  There is an almost
 
842
transparent implicit solution for HTML:
 
843
 
 
844
* Grab http://cben-hacks.sourceforge.net/bidi/hibidi.py and
 
845
  http://cben-hacks.sourceforge.net/bidi/rst2html_hibidi.py.
 
846
  Put them both in the same directory and make them executable.
 
847
  
 
848
* Use ``rst2html_hibidi.py`` instead of ``rst2html.py``.
 
849
 
 
850
* It infers dir attributes in the HTML from the text.  It does it
 
851
  hierachically, giving much better results than usual.  You can still
 
852
  use LRM/RLM and LRE/RLE/PDF control codes to help it.
 
853
 
 
854
  * If you want the gory details: See the full theory_, and note the
 
855
    incomplete practice_ (this is still a partial implementation - but
 
856
    sufficient for most needs).
 
857
 
 
858
    .. _theory: http://cben-hacks.sf.net/bidi/hibidi.html
 
859
    .. _practice: http://cben-hacks.sf.net/bidi/hibidi.html#practice
 
860
 
 
861
There is also an explicit way to set directions through CSS and
 
862
classes in the HTML:
 
863
 
 
864
* Copy ``default.css`` to a new file and add relevant parts of the
 
865
  following::
 
866
 
 
867
      /* Use these two if the main document direction is RTL */
 
868
      body { direction: rtl; }
 
869
      div.sidebar { float: left !important; }
 
870
 
 
871
      /* The next 3 rules are very useful in documents containing pieces
 
872
      of code in english */
 
873
      /* Use this if you all your literal blocks (::) are LTR */
 
874
      pre {direction: ltr; unicode-bidi: embed; }
 
875
      /* Use this if you all your inline literals (``) are LTR */
 
876
      tt {direction: ltr; unicode-bidi: embed; }
 
877
      /* Use this if you all your interpretted text (`) is LTR */
 
878
      cite {direction: ltr; unicode-bidi: embed; }
 
879
 
 
880
      /* Allow manual direction override by class directive and roles */
 
881
      .rtl { direction: rtl; }
 
882
      .ltr { direction: ltr; }
 
883
 
 
884
* Select this new stylesheet with ``--stylesheet=<file>`` or the
 
885
  stylesheet_ setting.
 
886
  
 
887
* Now if you need to override the direction of some element (from a
 
888
  paragraph to a whole section), write::
 
889
 
 
890
      .. class:: rtl
 
891
 
 
892
  or::
 
893
 
 
894
      .. class:: ltr
 
895
 
 
896
  before it (see the class_ directive for details).
 
897
 
 
898
* To change the direction of some inline text fragment, you can use
 
899
  RLE/LRE/PDF control characters, or write ``:rtl:`RTL text``` /
 
900
  ``:ltr:`RTL text```.  To use the latter syntax, you must write this
 
901
  once at the beginning of your document::
 
902
 
 
903
      .. role:: ltr
 
904
      .. role:: rtl
 
905
 
 
906
.. _stylesheet: docs/user/config.html#stylesheet
 
907
.. _class: docs/ref/rst/directives.txt#class
 
908
 
 
909
LaTeX is quite hard to implement (it doesn't support the bidi
 
910
algorithm, so all direction changes - even numbers in RTL text - must
 
911
be explicitly marked).  Other formats are more-or-less easy.
 
912
 
 
913
If you have any questions/problems/bugs related to bidi with docutils,
 
914
ask `Beni Cherniavsky`__ directly or the `Docutils-users`_ mailing
 
915
list.
 
916
 
 
917
__ mailto:cben@users.sf.net
 
918
 
 
919
 
 
920
What's the official MIME type for reStructuredText data?
 
921
--------------------------------------------------------
 
922
 
 
923
While there is no registered MIME type for reStructuredText, the
 
924
"official unofficial" standard MIME type is "text/x-rst".  This was
 
925
invented for the build system for PEPs (Python Enhancement Proposals),
 
926
and it's used by the python.org web site build system.
 
927
 
 
928
(The "x-" prefix means it's an unregistered MIME type.)
 
929
 
 
930
Also see `What's the standard filename extension for a
 
931
reStructuredText file?`_
 
932
 
 
933
 
748
934
HTML Writer
749
935
===========
750
936
 
870
1056
to your specific document, you might end up with bad HTML (e.g. H3
871
1057
without H2).
872
1058
 
873
 
.. _doctitle_xform:
874
 
   http://docutils.sourceforge.net/docs/user/config.html#doctitle-xform
875
 
.. _initial_header_level:
876
 
   http://docutils.sourceforge.net/docs/user/config.html#initial-header-level
 
1059
.. _doctitle_xform: docs/user/config.html#doctitle-xform
 
1060
.. _initial_header_level: docs/user/config.html#initial-header-level
877
1061
 
878
1062
(Thanks to Mark McEahern for the question and much of the answer.)
879
1063
 
880
1064
 
 
1065
How are lists formatted in HTML?
 
1066
--------------------------------
 
1067
 
 
1068
If list formatting looks strange, first check that you understand
 
1069
`list markup`__.
 
1070
 
 
1071
__ `How should I mark up lists?`_
 
1072
 
 
1073
* By default, HTML browsers indent lists relative to their context.
 
1074
  This follows a long tradition in browsers (but isn't so established
 
1075
  in print).  If you don't like it, you should change the stylesheet.
 
1076
 
 
1077
  This is different from how lists look in reStructuredText source.
 
1078
  Extra indentation in the source indicates a blockquote, resulting in
 
1079
  too much indentation in the browser.
 
1080
 
 
1081
* A list item can contain multiple paragraphs etc.  In complex cases
 
1082
  list items are separated by vertical space.  By default this spacing
 
1083
  is omitted in "simple" lists.  A list is simple if every item
 
1084
  contains a simple paragraph and/or a "simple" nested list.  For
 
1085
  example:
 
1086
 
 
1087
      * text
 
1088
 
 
1089
        * simple
 
1090
 
 
1091
          * simple
 
1092
          * simple
 
1093
 
 
1094
        * simple
 
1095
 
 
1096
        text after a nested list
 
1097
 
 
1098
      * multiple
 
1099
 
 
1100
        paragraphs
 
1101
 
 
1102
  In this example the nested lists are simple (and should appear
 
1103
  compacted) but the outer list is not.
 
1104
 
 
1105
  If you want all lists to have equal spacing, disable the
 
1106
  `compact_lists`_ setting (``--no-compact-lists`` option).  The
 
1107
  precise spacing can be controlled in the stylesheet.
 
1108
 
 
1109
  Note again that this is not exactly WYSIWYG: it partially resembles
 
1110
  the rules about blank lines being optional between list items in
 
1111
  reStructuredText -- but adding/removing optional blank lines does
 
1112
  not affect spacing in the output!  It's a feature, not a bug: you
 
1113
  write it as you like but the output is styled consistently.
 
1114
 
 
1115
  .. _compact_lists: docs/user/config.html#compact-lists
 
1116
 
 
1117
 
881
1118
Why do enumerated lists only use numbers (no letters or roman numerals)?
882
1119
------------------------------------------------------------------------
883
1120
 
884
1121
The rendering of enumerators (the numbers or letters acting as list
885
1122
markers) is completely governed by the stylesheet, so either the
886
 
browser can't find the stylesheet (try using the "--embed-stylesheet"
887
 
option), or the browser can't understand it (try a recent Firefox,
888
 
Mozilla, Konqueror, Opera, Safari, or even MSIE).
 
1123
browser can't find the stylesheet (try enabling the
 
1124
`embed_stylesheet`_ setting [``--embed-stylesheet`` option]), or the
 
1125
browser can't understand it (try a recent Firefox, Mozilla, Konqueror,
 
1126
Opera, Safari, or even MSIE).
 
1127
 
 
1128
.. _embed_stylesheet: docs/user/config.html#embed-stylesheet
889
1129
 
890
1130
 
891
1131
There appear to be garbage characters in the HTML.  What's up?
923
1163
recognizing that.  You can either try to fix your browser (enable
924
1164
"UTF-8 character set", sometimes called "Unicode"), or choose a
925
1165
different encoding for the HTML output.  You can also try
926
 
``--output-encoding=ascii:xmlcharrefreplace`` for HTML (not applicable
927
 
to non-XMLish outputs).
 
1166
``--output-encoding=ascii:xmlcharrefreplace`` for HTML or XML, but not
 
1167
applicable to non-XMLish outputs (if using runtime
 
1168
settings/configuration files, use ``output_encoding=ascii`` and
 
1169
``output_encoding_error_handler=xmlcharrefreplace``).
928
1170
 
929
1171
If you're generating document fragments, the "Content-Type" metadata
930
1172
(between the HTML ``<head>`` and ``</head>`` tags) must agree with the
937
1179
 
938
1180
    <?xml version="1.0" encoding="utf-8" ?>
939
1181
 
940
 
.. _sectnum:
941
 
   http://docutils.sourceforge.net/docs/ref/rst/directives.html#sectnum
 
1182
.. _sectnum: docs/ref/rst/directives.html#sectnum
942
1183
 
943
1184
 
944
1185
How can I retrieve the body of the HTML document?
950
1191
You can use the `docutils.core.publish_parts()`_ function, which
951
1192
returns a dictionary containing an 'html_body_' entry.
952
1193
 
953
 
.. _docutils.core.publish_parts():
954
 
   docs/api/publisher.html#publish-parts
955
 
.. _html_body:
956
 
   docs/api/publisher.html#html-body
 
1194
.. _docutils.core.publish_parts(): docs/api/publisher.html#publish-parts
 
1195
.. _html_body: docs/api/publisher.html#html-body
957
1196
 
958
1197
 
959
1198
Why is the Docutils XHTML served as "Content-type: text/html"?
980
1219
 
981
1220
Short answer: if we didn't serve XHTML as "text/html" (which is a
982
1221
perfectly valid thing to do), it couldn't be viewed in Internet
983
 
Explorer.  
 
1222
Explorer.
984
1223
 
985
1224
Long answer: see the `"Criticisms of Internet Explorer" Wikipedia
986
1225
entry <http://en.wikipedia.org/wiki/Criticisms_of_Internet_Explorer#XHTML>`__.
1047
1286
and have my own biases.  The Docutils document model is designed for
1048
1287
simplicity and extensibility, and has been influenced by the needs of
1049
1288
the reStructuredText markup.
 
1289
 
 
1290
 
 
1291
..
 
1292
   Local Variables:
 
1293
   mode: indented-text
 
1294
   indent-tabs-mode: nil
 
1295
   sentence-end-double-space: t
 
1296
   fill-column: 70
 
1297
   End: