git.iko.soy/typeable/pandoc
on master help sign in
Improved README on lists.
commit0d19adeeefb1c80e9e7b7f20a7084fcfbdae91c4 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 28 Jan 2011, 21:54 (16 years ago) parentd28daf0
1 file changed+123−10
README+123−10
README+123−10
@@ -806,18 +806,93 @@ Lists
806806
807807### Bullet lists ###
808808
809−TODO
809+A bullet list is a list of bulleted list items. A bulleted list
810+item begins with a bullet (`*`, `+`, or `-`). Here is a simple
811+example:
812+
813+ * one
814+ * two
815+ * three
816+
817+This will produce a "compact" list. If you want a "loose" list, in which
818+each item is formatted as a paragraph, put spaces between the items:
819+
820+ * one
821+
822+ * two
823+
824+ * three
825+
826+The bullets need not be flush with the left margin; they may be
827+indented one, two, or three spaces. The bullet must be followed
828+by whitespace.
829+
830+A list item may contain multiple paragraphs and other block-level
831+content. Subsequent paragraphs must be preceded by a blank line
832+and indented four spaces or a tab. The list will look better if
833+the first paragraph is aligned with the rest:
834+
835+ * First paragraph.
836+
837+ Continued.
838+
839+ * Second paragraph. With a code block, which must be indented
840+ eight spaces:
841+
842+ { code }
843+
844+List items may include other lists. In this case the preceding blank
845+line is optional. The nested list must be indented four spaces or
846+one tab:
847+
848+ * fruits
849+ + apples
850+ - macintosh
851+ - red delicious
852+ + pears
853+ + peaches
854+ * vegetables
855+ + brocolli
856+ + chard
857+
858+Markdown allows you to write list items "lazily," instead of
859+indenting continuation lines. However, if there are multiple paragraphs
860+or other blocks in a list item, the first line of each must be indented.
861+
862+ + A lazy, lazy, list
863+ item.
864+
865+ + Another one; this looks
866+ bad but is legal.
867+
868+ Second paragraph of second
869+ list item.
810870
811−TODO - rules for tight and loose
812871
813872### Ordered lists ###
814873
815−TODO - basic description
874+Ordered lists work just like bulleted lists, except that the items
875+begin with enumerators rather than bullets.
876+
877+In standard markdown, enumerators are decimal numbers followed
878+by a period and a space. The numbers themselves are ignored, so
879+there is no difference between this list:
880+
881+ 1. one
882+ 2. two
883+ 3. three
884+
885+and this one:
886+
887+ 5. one
888+ 7. two
889+ 1. three
890+
891+*Pandoc extension*.
816892
817893Unlike standard markdown, Pandoc allows ordered list items to be marked
818894with uppercase and lowercase letters and roman numerals, in addition to
819−arabic numerals. (This behavior can be turned off using the `--strict`
820−option.) List markers may be enclosed in parentheses or followed by a
895+arabic numerals. List markers may be enclosed in parentheses or followed by a
821896single right-parentheses or period. They must be separated from the
822897text that follows by at least one space, and, if the list marker is a
823898capital letter with a period, by at least two spaces.[^2]
@@ -937,18 +1012,18 @@ The label can be any string of alphanumeric characters, underscores,
9371012or hyphens.
9381013
9391014
940−### Nested lists ###
1015+### Compact and loose lists ###
9411016
942−Pandoc behaves differently from standard markdown on some "edge
1017+Pandoc behaves differently from `Markdown.pl` on some "edge
9431018cases" involving lists. Consider this source:
9441019
945− 1. First
946− 2. Second:
1020+ + First
1021+ + Second:
9471022 - Fee
9481023 - Fie
9491024 - Foe
9501025
951− 3. Third
1026+ + Third
9521027
9531028Pandoc transforms this into a "compact list" (with no `<p>` tags around
9541029"First", "Second", or "Third"), while markdown puts `<p>` tags around
@@ -962,6 +1037,44 @@ behavior is consistent with the official markdown syntax description,
9621037even though it is different from that of `Markdown.pl`.)
9631038
9641039
1040+### Ending a list ###
1041+
1042+What if you want to put an indented code block after a list?
1043+
1044+ - item one
1045+ - item two
1046+
1047+ { my code block }
1048+
1049+Trouble! Here pandoc (like other markdown implementations) will treat
1050+`{ my code block }` as the second paragraph of item two, and not as
1051+a code block.
1052+
1053+To "cut off" the list after item two, you can insert some non-indented
1054+content, like an HTML comment, which won't produce visible output in
1055+any format:
1056+
1057+ - item one
1058+ - item two
1059+
1060+ <!-- end of list -->
1061+
1062+ { my code block }
1063+
1064+You can use the same trick if you want two consecutive lists instead
1065+of one big list:
1066+
1067+ 1. one
1068+ 2. two
1069+ 3. three
1070+
1071+ <!-- -->
1072+
1073+ a. uno
1074+ b. dos
1075+ c. très
1076+
1077+
9651078Horizontal rules
9661079----------------
9671080