diff --git a/COPYRIGHT b/COPYRIGHT
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -44,13 +44,20 @@
 Released under the GPL.
 
 ----------------------------------------------------------------------
-ASCIIMathML.js
-Copyright 2005, Peter Jipsen, Chapman University
-<http://www1.chapman.edu/~jipsen/mathml/asciimath.html>
+Text/Pandoc/Biblio.hs
+Copyright (C) 2008 Andrea Rossato
 
 Released under the GPL.
 
 ----------------------------------------------------------------------
+LaTeXMathML.js
+Adapted by Jeff Knisely and Douglas Woodall from
+ASCIIMathML.js v. 1.4.7
+Copyright (C) 2005 Peter Jipsen
+
+Released under the GPL.
+
+----------------------------------------------------------------------
 S5 slides.js and css files 
 by Eric A. Meyer
 <http://meyerweb.com/eric/tools/s5
@@ -60,33 +67,9 @@
 ------------------------------------------------------------------------
 Diff.hs in tests/
 from the Diff package v 0.1.2 (Data.Algorithm.Diff)
-Copyright (c) Stering Clover 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. Neither the name of the author nor the names of his contributors
-   may be used to endorse or promote products derived from this software
-   without specific prior written permission.
+Copyright (c) Sterling Clover 2008
 
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
+Released under 3 clause BSD license.
 
 ------------------------------------------------------------------------
 windows/modpath.iss
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@
 PKG       := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL) | tr A-Z a-z)
 VERSION   := $(shell sed -ne 's/^[Vv]ersion:[[:space:]]*//p' $(CABAL))
 PKGID     := $(PKG)-$(VERSION)
-EXECSBASE := $(shell sed -ne 's/^[Ee]xecutable:\{0,1\}[[:space:]]*//p' $(CABAL))
+EXECSBASE := pandoc
 
 #-------------------------------------------------------------------------------
 # Install targets
@@ -101,7 +101,7 @@
 $(BUILDCMD): Setup.hs
 	$(GHC) -package Cabal Setup.hs -o $(BUILDCMD)
 $(BUILDCONF): $(CABAL) $(CABAL_BACKUP) $(BUILDCMD) $(templates)
-	$(BUILDCMD) configure --prefix=$(PREFIX) --with-compiler=$(GHC) $(hc_pkg) $(CABALOPTS)
+	$(BUILDCMD) configure --prefix=$(PREFIX) --with-compiler=$(GHC) $(hc_pkg) $(CABALOPTS) -f-wrappers
 	@# Make configuration time settings persistent (definitely a hack).
 	@echo "PREFIX?=$(PREFIX)" >$(BUILDVARS)
 	@echo "DESTDIR?=$(DESTDIR)" >>$(BUILDVARS)
@@ -120,8 +120,8 @@
 	done
 
 .PHONY: build-doc
-cleanup_files+=README.html $(MANPAGES)
-build-doc: $(DOCS) $(MANPAGES)
+cleanup_files+=README.html
+build-doc: $(DOCS)
 
 .PHONY: build-program
 build-program: build-exec build-doc
diff --git a/README b/README
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 % Pandoc User's Guide
 % John MacFarlane
-% March 24, 2008
+% December 7, 2009 
 
 Pandoc is a [Haskell] library for converting from one markup format to
 another, and a command-line tool that uses this library. It can read
@@ -37,7 +37,7 @@
 [Haskell]:  http://www.haskell.org/
 [GNU Texinfo]: http://www.gnu.org/software/texinfo/
 
-© 2006-8 John MacFarlane (jgm at berkeley dot edu). Released under the
+© 2006-9 John MacFarlane (jgm at berkeley dot edu). Released under the
 [GPL], version 2 or greater.  This software carries no warranty of
 any kind.  (See COPYRIGHT for full copyright and warranty notices.)
 Contributors:  Recai Oktaş (build system, debian package, wrapper
@@ -363,8 +363,8 @@
     displayed all at once.
 
 `-N` or `--number-sections`
-:   causes sections to be numbered in LaTeX or ConTeXt output. By default,
-    sections are not numbered.
+:   causes sections to be numbered in LaTeX, ConTeXt, or HTML output.
+    By default, sections are not numbered.
 
 `--no-wrap`
 :   disables text-wrapping in output.  By default, text is wrapped
@@ -384,6 +384,16 @@
     is specified, *references* is used regardless of the presence
     of this option.
 
+`--id-prefix`*=string*
+:   specifies a prefix to be added to all automatically generated identifiers
+    in HTML output.  This is useful for preventing duplicate identifiers
+    when generating fragments to be included in other pages.
+
+`--indented-code-classes`*=classes*
+:   specifies classes to use for indented code blocks--for example,
+    `perl,numberLines` or `haskell`. Multiple classes may be separated
+    by spaces or commas.
+
 `--dump-args`
 :   is intended to make it easier to create wrapper scripts that use
     Pandoc. It causes Pandoc to dump information about the arguments
@@ -458,8 +468,15 @@
     \`*_{}[]()>#+-.!
 
 A backslash-escaped space is parsed as a nonbreaking space.  It will
-appear in TeX output as '~' and in HTML and XML as '\&#160;' or '\&nbsp;'.
+appear in TeX output as '`~`' and in HTML and XML as '`\&#160;`' or
+'`\&nbsp;`'.
 
+A backslash-escaped newline (i.e. a backslash occurring at the end of
+a line) is parsed as a hard line break.  It will appear in TeX output as
+'`\\`' and in HTML as '`<br />`'.  This is a nice alternative to
+markdown's "invisible" way of indicating hard line breaks using
+two trailing spaces on a line.
+
 Subscripts and superscripts
 ---------------------------
 
@@ -664,11 +681,11 @@
 
 Simple tables look like this:
 
-      Right     Left     Center     Default   
-    -------     ------ ----------   -------   
-         12     12        12            12    
-        123     123       123          123    
-          1     1          1             1    
+      Right     Left     Center     Default
+    -------     ------ ----------   -------
+         12     12        12            12
+        123     123       123          123
+          1     1          1             1
 
     Table:  Demonstration of simple table syntax.
 
@@ -688,15 +705,24 @@
 [^3]:  This scheme is due to Michel Fortin, who proposed it on the
        [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
 
-The table must end with a blank line.  Optionally, a caption may be
-provided (as illustrated in the example above).  A caption is a paragraph
-beginning with the string `Table:`, which will be stripped off.
+The table must end with a blank line, or a line of dashes followed by
+a blank line. A caption may optionally be provided (as illustrated in
+the example above). A caption is a paragraph beginning with the string
+`Table:`, which will be stripped off.
 
-The table parser pays attention to the widths of the columns, and
-the writers try to reproduce these relative widths in the output.
-So, if you find that one of the columns is too narrow in the output,
-try widening it in the markdown source.
+The column headers may be omitted, provided a dashed line is used
+to end the table. For example:
 
+    -------     ------ ----------   -------
+         12     12        12             12
+        123     123       123           123
+          1     1          1              1
+    -------     ------ ----------   -------
+
+When headers are omitted, column alignments are determined on the basis
+of the first line of the table body. So, in the tables above, the columns
+would be right, left, center, and right aligned, respectively.
+
 Multiline tables allow headers and table rows to span multiple lines
 of text.  Here is an example:
 
@@ -706,21 +732,44 @@
     ----------- ------- --------------- -------------------------
        First    row                12.0 Example of a row that
                                         spans multiple lines.
-    
+
       Second    row                 5.0 Here's another one. Note
                                         the blank line between
                                         rows.
     -------------------------------------------------------------
-    
+
     Table: Here's the caption. It, too, may span
     multiple lines.
 
 These work like simple tables, but with the following differences:
 
-  - They must begin with a row of dashes, before the header text.
+  - They must begin with a row of dashes, before the header text
+    (unless the headers are omitted).
   - They must end with a row of dashes, then a blank line.
-  - The rows must be separated by blank lines. 
+  - The rows must be separated by blank lines.
 
+In multiline tables, the table parser pays attention to the widths of
+the columns, and the writers try to reproduce these relative widths in
+the output. So, if you find that one of the columns is too narrow in the
+output, try widening it in the markdown source.
+
+Headers may be omitted in multiline tables as well as simple tables:
+
+    ----------- ------- --------------- -------------------------
+       First    row                12.0 Example of a row that
+                                        spans multiple lines.
+
+      Second    row                 5.0 Here's another one. Note
+                                        the blank line between
+                                        rows.
+    -------------------------------------------------------------
+
+    Table: Here's a multiline table without headers.
+
+It is possible for a multiline table to have just one row, but the row
+should be followed by a blank line (and then the row of dashes that ends
+the table), or the table may be interpreted as a simple table.
+
 Delimited Code blocks
 ---------------------
 
@@ -865,8 +914,9 @@
 derive the identifier from the header text,
 
   - Remove all formatting, links, etc.
-  - Remove all punctuation, except dashes and hyphens.
-  - Replace all spaces, dashes, newlines, and hyphens with hyphens.
+  - Remove all punctuation, except underscores, hyphens, periods,
+    and tildes.
+  - Replace all spaces and newlines with hyphens.
   - Convert all alphabetic characters to lowercase.
   - Remove everything up to the first letter (identifiers may
     not begin with a number or punctuation mark).
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,3 +1,151 @@
+pandoc (1.3)
+
+  [ John MacFarlane ]
+
+  * Added --id-prefix option (Issue #41). This adds a prefix to all
+    automatically generated HTML identifiers, which helps prevent
+    duplicate identifiers when you're generating a fragment (say a blog
+    post).
+
+  * Added --indented-code-classes option.  This specifies classes
+    to use for indented code blocks.  (Patch due to buttock; Issue #87.)
+
+  * --number-sections now affects HTML output as well as ConTeXt and LaTeX
+    (Issue #150).
+
+  * Improved syntax for markdown definition lists (Issue #24).
+    Definition lists are now more compatible with PHP Markdown Extra.
+    + You can have multiple definitions for a term (but still not
+      multiple terms).
+    + Multi-block definitions no longer need a column before each block
+      (indeed, this will now cause multiple definitions).
+    + The marker no longer needs to be flush with the left margin,
+      but can be indented at or two spaces.  Also, ~ as well as :
+      can be used as the marker (this suggestion due to David
+      Wheeler.)
+    + There can now be a blank line between the term and the
+      definitions.
+
+  * Better looking simple tables.  Resolves Issue #180.
+    + Markdown reader: simple tables are now given column widths of 0.
+    + Column width of 0 is interpreted as meaning: use default column width.
+    + Writers now include explicit column width information only
+      for multiline tables.  (Exception:  RTF writer, which requires
+      column widths.  In this case, columns are given equal widths,
+      adding up to the text width.)
+    + Simple tables should now look better in most output formats.
+
+  * Allow markdown tables without headers (Issue #50).
+    The new syntax is described in README. Also allow optional line of
+    dashes at bottom of simple tables.
+
+  * Compensate for width of final table column (Issue #144).
+
+  * Treat a backslash followed by a newline as a hard line break
+    in markdown.  Resolves Issue #154.  This is a nice alternative
+	to markdown's "invisible" way of indicating hardline breaks
+	using lines that end with two spaces.
+
+  * Improved performance of markdown reader by ~10% by eliminating the
+    need for a separate parsing pass for notes. Raw notes are now stored
+    on the first pass (which parses references), then parsed when the
+    note is inserted into the AST. The stateNotes field in ParserState
+    is now a list of [(String, String)] pairs instead of [(String,
+    [Block])].
+
+  * In markdown reader, treat 4 or more * or _ in a row as literal
+    text.  (Trying to parse long strings of * or _ as strong or emph
+	leads to exponential performance problems.)
+
+  * Markdown reader: Use + rather than %20 for spaces in URLs.
+
+  * Fixed htmlComment parser, adding a needed 'try'.
+
+  * Don't print raw HTML in man output.
+
+  * Allow . _ and ~ in header identifiers.
+
+  * Specially mark code blocks that were "literate" in the input.
+    They can then be treated differently in the writers.  This allows
+    authors to distinguish bits of the literate program they are writing
+    from source code examples, even if the examples are marked as
+    Haskell for highlighting.  (Issue #174.)
+
+  * Modified html+lhs output to use "haskell" highlighter instead
+    of "literateHaskell". The highlighting module now adds bird tracks
+	after highlighting (for HTML output), if the code block has the
+	"literate" class.  This gives better results, because kate's
+    haskell highlighter is much better than the literateHaskell
+    highlighter.
+
+  * Fixed handling of footnotes in titles (HTML) and headers (LaTeX).
+    (Issue #137.)
+
+  * Support for "..code-block" directive in RST reader. Not core
+    RST, but used in Sphinx for code blocks annotated with syntax
+    information. Thanks to Luke Plant for the patch.
+
+  * Added "head" to list of block-level HTML tags. Resolves
+    Issue #108.
+
+  * Added stripTags to Text.Pandoc.XML.  This is used in the HTML writer.
+
+  * Set utf-8 encoding in texinfo headers.
+
+  * Docbook writer: add ids to sections.  Use link for internal links.
+    (Issue #60.)
+
+  * Blank lines after lists in MediaWiki writer.
+
+  * Properly handle commented-out list items in markdown.
+    Resolves Issue #142.  Example:
+
+    - a
+    <!--
+    - b
+    -->
+    - c
+
+  * Changed heuristic in compactify. compactify has to decide whether a
+    Para that ends a list is a Para intentionally, or just because of
+    the blank lines at the end of every list. In the latter case the
+    Para is turned to a Plain. The old heuristic was: change final Para
+    to Plain iff the other items all end in Plain. This produces bad
+    results when, for example, an item contains just a Plain and an HTML
+    comment, as it does in the list above. The new heuristic: change
+    final Para to Plain iff the other items don't contain a Para.
+
+  * Added % as an rst underline character.  Resolves Issue #173.
+
+  * Fix inline math parser so that \$ is allowed in math.
+    Resolves Issue #169.
+
+  * Translate \int (integral) into unicode when using unicode math
+    method. Resolves Issue #177.
+
+  * markdown2pdf.hs improvements:
+    + Use System.IO.UTF8.
+    + Print error messages on last attempt.
+    + Do not create a backup when overwriting a PDF (Issue #166).
+    + Accept --longopt=val options.
+    + Added man/man1/markdown2pdf.1 to extra-tmp-files in cabal, so that
+      it is properly cleaned.
+
+  * Added haddock comments warning that readers assume \n line endings.
+
+  * Updated COPYRIGHT file.
+
+  * Makefile: Changed EXECSBASE so it doesn't pull in hsmarkdown &
+    markdown2pdf. Otherwise strip tries to strip shell scripts when you
+    install using 'make'.
+
+  * Changed Makefile so it doesn't build Haskell wrappers.
+
+  * Fixed Makefile so it doesn't try to build man pages in build-doc.
+
+  * Install pcre3.dll in Windows install script; this allows us to
+    package a version of pandoc with highlighting support.
+
 pandoc (1.2.1)
 
   [ John MacFarlane ]
diff --git a/man/man1/pandoc.1.md b/man/man1/pandoc.1.md
--- a/man/man1/pandoc.1.md
+++ b/man/man1/pandoc.1.md
@@ -134,8 +134,8 @@
 :   Make list items in S5 display incrementally (one by one).
 
 -N, \--number-sections
-:   Number section headings in LaTeX output.  (Default is not to number
-    them.)
+:   Number section headings in LaTeX, ConTeXt, or HTML output.
+    (Default is not to number them.)
 
 \--no-wrap
 :   Disable text wrapping in output. (Default is to wrap text.)
@@ -153,6 +153,16 @@
     letters as decimal or hexadecimal character references.
     If `--strict` is specified, *references* is used regardless of the
     presence of this option.
+
+\--id-prefix*=string*
+:   Specify a prefix to be added to all automatically generated identifiers
+    in HTML output.  This is useful for preventing duplicate identifiers
+    when generating fragments to be included in other pages.
+
+\--indented-code-classes*=classes*
+:   Specify classes to use for indented code blocks--for example,
+    `perl,numberLines` or `haskell`. Multiple classes may be separated
+    by spaces or commas.
 
 \--toc, \--table-of-contents
 :   Include an automatically generated table of contents (HTML, markdown,
diff --git a/markdown2pdf b/markdown2pdf
--- a/markdown2pdf
+++ b/markdown2pdf
@@ -125,16 +125,6 @@
     done
 ) || exit $?
 
-is_target_exists=
-if [ -f "$destname" ]; then
-    is_target_exists=1
-    mv "$destname" "$destname~" 
-fi
-
 mv -f $THIS_TEMPDIR/$texname.pdf "$destname"
 
-errn "Created $destname"
-[ -z "$is_target_exists" ] || {
-    errn " (previous file has been backed up as $destname~)"
-}
-err .
+err "Created $destname"
diff --git a/pandoc.cabal b/pandoc.cabal
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,5 +1,5 @@
 Name:            pandoc
-Version:         1.2.1
+Version:         1.3
 Cabal-Version:   >= 1.2
 Build-Type:      Custom
 License:         GPL
@@ -129,7 +129,7 @@
                  tests/Diff.hs,
                  tests/RunTests.hs
 Extra-Tmp-Files: man/man1/pandoc.1, man/man1/hsmarkdown.1,
-                 man/man1/html2markdown.1
+                 man/man1/html2markdown.1, man/man1/markdown2pdf.1
 
 Flag highlighting
   Description:   Compile in support for syntax highlighting of code blocks.
@@ -138,8 +138,8 @@
   Description:   Build the pandoc executable.
   Default:       True
 Flag wrappers
-  Description:   Build the wrappers (hsmarkdown, html2markdown, markdown2pdf).
-  Default:       False
+  Description:   Build the wrappers (hsmarkdown, markdown2pdf).
+  Default:       True
 Flag library
   Description:   Build the pandoc library.
   Default:       True
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -45,6 +45,10 @@
 > 
 > main = U.getContents >>= U.putStrLn . markdownToRST
 
+Note:  all of the readers assume that the input text has @'\n'@
+line endings.  So if you get your input text from a web form,
+you should remove @'\r'@ characters using @filter (/='\r')@.
+
 -}
 
 module Text.Pandoc
diff --git a/src/Text/Pandoc/Definition.hs b/src/Text/Pandoc/Definition.hs
--- a/src/Text/Pandoc/Definition.hs
+++ b/src/Text/Pandoc/Definition.hs
@@ -79,16 +79,17 @@
                             -- and a list of items, each a list of blocks)
     | BulletList [[Block]]  -- ^ Bullet list (list of items, each
                             -- a list of blocks)
-    | DefinitionList [([Inline],[Block])]  -- ^ Definition list 
-                            -- (list of items, each a pair of an inline list,
-                            -- the term, and a block list)
+    | DefinitionList [([Inline],[[Block]])]  -- ^ Definition list 
+                            -- Each list item is a pair consisting of a
+                            -- term (a list of inlines) and one or more
+                            -- definitions (each a list of blocks)
     | Header Int [Inline]   -- ^ Header - level (integer) and text (inlines) 
     | HorizontalRule        -- ^ Horizontal rule
     | Table [Inline] [Alignment] [Double] [[Block]] [[[Block]]]  -- ^ Table,
                             -- with caption, column alignments,
-                            -- relative column widths, column headers
-                            -- (each a list of blocks), and rows
-                            -- (each a list of lists of blocks)
+                            -- relative column widths (0 = default),
+                            -- column headers (each a list of blocks), and
+                            -- rows (each a list of lists of blocks)
     | Null                  -- ^ Nothing
     deriving (Eq, Read, Show, Typeable, Data)
 
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs
--- a/src/Text/Pandoc/Highlighting.hs
+++ b/src/Text/Pandoc/Highlighting.hs
@@ -45,12 +45,16 @@
                 case find (`elem` ["number","numberLines","number-lines"]) classes of
                   Nothing   -> []
                   Just _    -> [OptNumberLines]
+      addBirdTracks = "literate" `elem` classes
       lcLanguages = map (map toLower) languages
   in  case find (\c -> (map toLower c) `elem` lcLanguages) classes of
             Nothing        -> Left "Unknown or unsupported language"
             Just language  -> case highlightAs language rawCode of
                                    Left err -> Left err
-                                   Right hl -> Right $ formatAsXHtml fmtOpts language hl
+                                   Right hl -> Right $ formatAsXHtml fmtOpts language $
+                                                       if addBirdTracks
+                                                          then map ((["Special"],"> "):) hl
+                                                          else hl
 
 #else
 defaultHighlightingCss :: String
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -38,6 +38,7 @@
                                  htmlEndTag,
                                  extractTagType,
                                  htmlBlockElement,
+                                 htmlComment,
                                  unsanitaryURI
                                 ) where
 
@@ -52,7 +53,7 @@
 
 -- | Convert HTML-formatted string to 'Pandoc' document.
 readHtml :: ParserState   -- ^ Parser state
-         -> String        -- ^ String to parse
+         -> String        -- ^ String to parse (assumes @'\n'@ line endings)
          -> Pandoc
 readHtml = readWith parseHtml
 
@@ -76,7 +77,7 @@
 blockHtmlTags :: [[Char]]
 blockHtmlTags = ["address", "blockquote", "body", "center", "dir", "div",
                  "dl", "fieldset", "form", "h1", "h2", "h3", "h4",
-                 "h5", "h6", "hr", "html", "isindex", "menu", "noframes",
+                 "h5", "h6", "head", "hr", "html", "isindex", "menu", "noframes",
                  "noscript", "ol", "p", "pre", "table", "ul", "dd",
                  "dt", "frameset", "li", "tbody", "td", "tfoot",
                  "th", "thead", "tr", "script"] ++ eitherBlockOrInline
@@ -346,8 +347,8 @@
 htmlComment :: GenParser Char st [Char]
 htmlComment = try $ do
   string "<!--"
-  comment <- many (   (satisfy (/='-'))
-                  <|> (char '-' >>~ notFollowedBy (try $ char '-' >> char '>')))
+  comment <- many $ noneOf "-"
+               <|> try (char '-' >>~ notFollowedBy (try (char '-' >> char '>')))
   string "-->"
   return $ "<!--" ++ comment ++ "-->"
 
@@ -544,12 +545,12 @@
   htmlEndTag "dl"
   return $ DefinitionList items
 
-definitionListItem :: GenParser Char ParserState ([Inline], [Block])
+definitionListItem :: GenParser Char ParserState ([Inline], [[Block]])
 definitionListItem = try $ do
   terms <- sepEndBy1 (inlinesIn "dt") spaces
   defs <- sepEndBy1 (blocksIn "dd") spaces
   let term = intercalate [LineBreak] terms
-  return (term, concat defs)
+  return (term, defs)
 
 --
 -- paragraph block
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -42,7 +42,7 @@
 
 -- | Parse LaTeX from string and return 'Pandoc' document.
 readLaTeX :: ParserState   -- ^ Parser state, including options for parser
-          -> String        -- ^ String to parse
+          -> String        -- ^ String to parse (assumes @'\n'@ line endings)
           -> Pandoc
 readLaTeX = readWith parseLaTeX
 
@@ -207,7 +207,7 @@
 lhsCodeBlock = do
   failUnlessLHS
   (CodeBlock (_,_,_) cont) <- codeBlockWith "code"
-  return $ CodeBlock ("", ["sourceCode","haskell"], []) cont
+  return $ CodeBlock ("", ["sourceCode","literate","haskell"], []) cont
 
 --
 -- block quotes
@@ -282,7 +282,7 @@
   items <- many listItem
   end "description"
   spaces
-  return (DefinitionList items)
+  return $ DefinitionList $ map (\(t,d) -> (t,[d])) items
 
 --
 -- paragraph block
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -42,13 +42,15 @@
 import Text.Pandoc.Readers.HTML ( rawHtmlBlock, anyHtmlBlockTag, 
                                   anyHtmlInlineTag, anyHtmlTag,
                                   anyHtmlEndTag, htmlEndTag, extractTagType,
-                                  htmlBlockElement, unsanitaryURI )
+                                  htmlBlockElement, htmlComment, unsanitaryURI )
 import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
 import Text.ParserCombinators.Parsec
-import Control.Monad (when)
+import Control.Monad (when, liftM, unless)
 
 -- | Read markdown from an input string and return a Pandoc document.
-readMarkdown :: ParserState -> String -> Pandoc
+readMarkdown :: ParserState -- ^ Parser state, including options for parser
+             -> String      -- ^ String to parse (assuming @'\n'@ line endings)
+             -> Pandoc
 readMarkdown state s = (readWith parseMarkdown) state (s ++ "\n\n")
 
 --
@@ -107,7 +109,7 @@
 failUnlessSmart :: GenParser tok ParserState ()
 failUnlessSmart = do
   state <- getState
-  if stateSmart state then return () else fail "Smart typography feature"
+  if stateSmart state then return () else pzero
 
 -- | Parse a sequence of inline elements between square brackets,
 -- including inlines between balanced pairs of square brackets.
@@ -116,9 +118,7 @@
 inlinesInBalancedBrackets parser = try $ do
   char '['
   result <- manyTill ( (do lookAhead $ try $ do (Str res) <- parser
-                                                if res == "["
-                                                   then return ()
-                                                   else pzero
+                                                unless (res == "[") pzero
                            bal <- inlinesInBalancedBrackets parser
                            return $ [Str "["] ++ bal ++ [Str "]"])
                        <|> (count 1 parser))
@@ -162,23 +162,18 @@
   -- markdown allows raw HTML
   updateState (\state -> state { stateParseRaw = True })
   startPos <- getPosition
-  -- go through once just to get list of reference keys
-  -- docMinusKeys is the raw document with blanks where the keys were...
-  docMinusKeys <- manyTill (referenceKey <|> lineClump) eof >>= 
-                  return . concat
+  -- go through once just to get list of reference keys and notes
+  -- docMinusKeys is the raw document with blanks where the keys/notes were...
+  st <- getState
+  let firstPassParser = referenceKey
+                     <|> (if stateStrict st then pzero else noteBlock)
+                     <|> lineClump
+  docMinusKeys <- liftM concat $ manyTill firstPassParser eof
   setInput docMinusKeys
   setPosition startPos
-  st <- getState
-  -- go through again for notes unless strict...
-  if stateStrict st
-     then return ()
-     else do docMinusNotes <- manyTill (noteBlock <|> lineClump) eof >>= 
-                              return . concat
-             st' <- getState
-             let reversedNotes = stateNotes st'
-             updateState $ \s -> s { stateNotes = reverse reversedNotes }
-             setInput docMinusNotes
-             setPosition startPos
+  st' <- getState
+  let reversedNotes = stateNotes st'
+  updateState $ \s -> s { stateNotes = reverse reversedNotes }
   -- now parse it for real...
   (title, author, date) <- option ([],[],"") titleBlock
   blocks <- parseBlocks
@@ -201,7 +196,7 @@
   tit <- option "" referenceTitle
   blanklines
   endPos <- getPosition
-  let newkey = (lab, (intercalate "%20" $ words $ removeTrailingSpace src,  tit))
+  let newkey = (lab, (intercalate "+" $ words $ removeTrailingSpace src,  tit))
   st <- getState
   let oldkeys = stateKeys st
   updateState $ \s -> s { stateKeys = newkey : oldkeys }
@@ -241,9 +236,7 @@
   raw <- sepBy rawLines (try (blankline >> indentSpaces))
   optional blanklines
   endPos <- getPosition
-  -- parse the extracted text, which may contain various block elements:
-  contents <- parseFromString parseBlocks $ (intercalate "\n" raw) ++ "\n\n"
-  let newnote = (ref, contents)
+  let newnote = (ref, (intercalate "\n" raw) ++ "\n\n")
   st <- getState
   let oldnotes = stateNotes st
   updateState $ \s -> s { stateNotes = newnote : oldnotes }
@@ -399,13 +392,15 @@
                              l <- indentedLine
                              return $ b ++ l))
   optional blanklines
-  return $ CodeBlock ("",[],[]) $ stripTrailingNewlines $ concat contents
+  st <- getState
+  return $ CodeBlock ("", stateIndentedCodeClasses st, []) $
+           stripTrailingNewlines $ concat contents
 
 lhsCodeBlock :: GenParser Char ParserState Block
 lhsCodeBlock = do
   failUnlessLHS
   contents <- lhsCodeBlockBird <|> lhsCodeBlockLaTeX
-  return $ CodeBlock ("",["sourceCode","haskell"],[]) contents
+  return $ CodeBlock ("",["sourceCode","literate","haskell"],[]) contents
 
 lhsCodeBlockLaTeX :: GenParser Char ParserState String
 lhsCodeBlockLaTeX = try $ do
@@ -502,8 +497,8 @@
   notFollowedBy' (do indentSpaces
                      many (spaceChar)
                      listStart)
-  line <- manyTill anyChar newline
-  return $ line ++ "\n"
+  chunks <- manyTill (htmlComment <|> count 1 anyChar) newline
+  return $ concat chunks ++ "\n"
 
 -- parse raw text for one list item, excluding start marker and continuations
 rawListItem :: GenParser Char ParserState [Char]
@@ -560,38 +555,61 @@
 
 -- definition lists
 
-definitionListItem :: GenParser Char ParserState ([Inline], [Block])
+defListMarker :: GenParser Char ParserState ()
+defListMarker = do
+  sps <- nonindentSpaces
+  char ':' <|> char '~'
+  st <- getState
+  let tabStop = stateTabStop st
+  let remaining = tabStop - (length sps + 1)
+  if remaining > 0
+     then count remaining (char ' ') <|> string "\t"
+     else pzero
+  return ()
+
+definitionListItem :: GenParser Char ParserState ([Inline], [[Block]])
 definitionListItem = try $ do
-  notFollowedBy blankline
-  notFollowedBy' indentSpaces
   -- first, see if this has any chance of being a definition list:
-  lookAhead (anyLine >> char ':')
+  lookAhead (anyLine >> optional blankline >> defListMarker)
   term <- manyTill inline newline
+  optional blankline
   raw <- many1 defRawBlock
   state <- getState
   let oldContext = stateParserContext state
   -- parse the extracted block, which may contain various block elements:
-  contents <- parseFromString parseBlocks $ concat raw
+  contents <- mapM (parseFromString parseBlocks) raw
   updateState (\st -> st {stateParserContext = oldContext})
   return ((normalizeSpaces term), contents)
 
 defRawBlock :: GenParser Char ParserState [Char]
 defRawBlock = try $ do
-  char ':'
-  state <- getState
-  let tabStop = stateTabStop state
-  try (count (tabStop - 1) (char ' ')) <|> (many (char ' ') >> string "\t")
+  defListMarker
   firstline <- anyLine
   rawlines <- many (notFollowedBy blankline >> indentSpaces >> anyLine)
   trailing <- option "" blanklines
-  return $ firstline ++ "\n" ++ unlines rawlines ++ trailing
+  cont <- liftM concat $ many $ do
+            lns <- many1 $ notFollowedBy blankline >> indentSpaces >> anyLine
+            trl <- option "" blanklines
+            return $ unlines lns ++ trl
+  return $ firstline ++ "\n" ++ unlines rawlines ++ trailing ++ cont
 
 definitionList :: GenParser Char ParserState Block
 definitionList = do
   items <- many1 definitionListItem
-  let (terms, defs) = unzip items
-  let defs' = compactify defs
-  let items' = zip terms defs'
+  -- "compactify" the definition list:
+  let defs = map snd items
+  let defBlocks = reverse $ concat $ concat defs
+  let isPara (Para _) = True
+      isPara _        = False
+  let items' = case take 1 defBlocks of
+                [Para x]   -> if not $ any isPara (drop 1 defBlocks)
+                                 then let (t,ds) = last items
+                                          lastDef = last ds
+                                          ds' = init ds ++
+                                                [init lastDef ++ [Plain x]]
+                                       in init items ++ [(t, ds')]
+                                 else items
+                _          -> items
   return $ DefinitionList items'
 
 --
@@ -681,26 +699,36 @@
   return $ (length dashes, length $ dashes ++ sp)
 
 -- Parse a table header with dashed lines of '-' preceded by 
--- one line of text.
-simpleTableHeader :: GenParser Char ParserState ([[Char]], [Alignment], [Int])
-simpleTableHeader = try $ do
-  rawContent  <- anyLine
+-- one (or zero) line of text.
+simpleTableHeader :: Bool  -- ^ Headerless table 
+                  -> GenParser Char ParserState ([[Char]], [Alignment], [Int])
+simpleTableHeader headless = try $ do
+  rawContent  <- if headless
+                    then return ""
+                    else anyLine
   initSp      <- nonindentSpaces
   dashes      <- many1 (dashedLine '-')
   newline
   let (lengths, lines') = unzip dashes
   let indices  = scanl (+) (length initSp) lines'
-  let rawHeads = tail $ splitByIndices (init indices) rawContent
+  -- If no header, calculate alignment on basis of first row of text
+  rawHeads <- liftM (tail . splitByIndices (init indices)) $
+              if headless
+                 then lookAhead anyLine 
+                 else return rawContent
   let aligns   = zipWith alignType (map (\a -> [a]) rawHeads) lengths
-  return (rawHeads, aligns, indices)
+  let rawHeads' = if headless
+                     then replicate (length dashes) ""
+                     else rawHeads 
+  return (rawHeads', aligns, indices)
 
 -- Parse a table footer - dashed lines followed by blank line.
 tableFooter :: GenParser Char ParserState [Char]
 tableFooter = try $ skipNonindentSpaces >> many1 (dashedLine '-') >> blanklines
 
 -- Parse a table separator - dashed line.
-tableSep :: GenParser Char ParserState String
-tableSep = try $ skipNonindentSpaces >> many1 (dashedLine '-') >> string "\n"
+tableSep :: GenParser Char ParserState Char
+tableSep = try $ skipNonindentSpaces >> many1 (dashedLine '-') >> char '\n'
 
 -- Parse a raw line and split it into chunks by indices.
 rawTableLine :: [Int]
@@ -731,7 +759,17 @@
                   -> [Double] -- Fractional relative sizes of columns
 widthsFromIndices _ [] = []  
 widthsFromIndices numColumns indices = 
-  let lengths = zipWith (-) indices (0:indices)
+  let lengths' = zipWith (-) indices (0:indices)
+      lengths  = reverse $
+                 case reverse lengths' of
+                      []       -> []
+                      [x]      -> [x]
+                      -- compensate for the fact that intercolumn
+                      -- spaces are counted in widths of all columns
+                      -- but the last...
+                      (x:y:zs) -> if x < y && y - x <= 2
+                                     then y:y:zs
+                                     else x:y:zs
       totLength = sum lengths
       quotient = if totLength > numColumns
                    then fromIntegral totLength
@@ -765,30 +803,48 @@
     return $ Table caption aligns widths heads lines'
 
 -- Parse a simple table with '---' header and one line per row.
-simpleTable :: GenParser Char ParserState Block
-simpleTable = tableWith simpleTableHeader tableLine blanklines
+simpleTable :: Bool  -- ^ Headerless table
+            -> GenParser Char ParserState Block
+simpleTable headless = do
+  Table c a _w h l <- tableWith (simpleTableHeader headless) tableLine
+               (if headless then tableFooter else tableFooter <|> blanklines)
+  -- Simple tables get 0s for relative column widths (i.e., use default)
+  return $ Table c a (replicate (length a) 0) h l
 
 -- Parse a multiline table:  starts with row of '-' on top, then header
 -- (which may be multiline), then the rows,
 -- which may be multiline, separated by blank lines, and
 -- ending with a footer (dashed line followed by blank line).
-multilineTable :: GenParser Char ParserState Block
-multilineTable = tableWith multilineTableHeader multilineRow tableFooter
+multilineTable :: Bool -- ^ Headerless table
+               -> GenParser Char ParserState Block
+multilineTable headless =
+  tableWith (multilineTableHeader headless) multilineRow tableFooter
 
-multilineTableHeader :: GenParser Char ParserState ([String], [Alignment], [Int])
-multilineTableHeader = try $ do
-  tableSep 
-  rawContent  <- many1 (notFollowedBy' tableSep >> many1Till anyChar newline)
+multilineTableHeader :: Bool -- ^ Headerless table
+                     -> GenParser Char ParserState ([String], [Alignment], [Int])
+multilineTableHeader headless = try $ do
+  if headless
+     then return '\n'
+     else tableSep
+  rawContent  <- if headless
+                    then return $ repeat "" 
+                    else many1
+                         (notFollowedBy tableSep >> many1Till anyChar newline)
   initSp      <- nonindentSpaces
   dashes      <- many1 (dashedLine '-')
   newline
   let (lengths, lines') = unzip dashes
   let indices  = scanl (+) (length initSp) lines'
-  let rawHeadsList = transpose $ map 
-                     (\ln -> tail $ splitByIndices (init indices) ln)
-                     rawContent
-  let rawHeads = map (intercalate " ") rawHeadsList
+  rawHeadsList <- if headless
+                     then liftM (map (:[]) . tail .
+                              splitByIndices (init indices)) $ lookAhead anyLine
+                     else return $ transpose $ map 
+                           (\ln -> tail $ splitByIndices (init indices) ln)
+                           rawContent
   let aligns   = zipWith alignType rawHeadsList lengths
+  let rawHeads = if headless
+                    then replicate (length dashes) ""
+                    else map (intercalate " ") rawHeadsList
   return ((map removeLeadingTrailingSpace rawHeads), aligns, indices)
 
 -- Returns an alignment type for a table, based on a list of strings
@@ -810,7 +866,8 @@
         (False, False)   -> AlignDefault
 
 table :: GenParser Char ParserState Block
-table = simpleTable <|> multilineTable <?> "table"
+table = multilineTable False <|> simpleTable True <|>
+        simpleTable False <|> multilineTable True <?> "table"
 
 -- 
 -- inline
@@ -826,6 +883,7 @@
                 , endline
                 , code
                 , charRef
+                , (fourOrMore '*' <|> fourOrMore '_')
                 , strong
                 , emph
                 , note
@@ -862,10 +920,10 @@
   result <- option '\\' $ if stateStrict state 
                              then oneOf "\\`*_{}[]()>#+-.!~"
                              else satisfy (not . isAlphaNum)
-  let result' = if result == ' '
-                   then '\160'  -- '\ ' is a nonbreaking space
-                   else result
-  return $ Str [result']
+  return $ case result of
+                ' '   -> Str "\160" -- "\ " is a nonbreaking space
+                '\n'  -> LineBreak  -- "\[newline]" is a linebreak
+                _     -> Str [result]
 
 ltSign :: GenParser Char ParserState Inline
 ltSign = do
@@ -895,9 +953,14 @@
   return $ Code $ removeLeadingTrailingSpace $ concat result
 
 mathWord :: GenParser Char st [Char]
-mathWord = many1 ((noneOf " \t\n\\$") <|>
-                  (try (char '\\') >>~ notFollowedBy (char '$')))
+mathWord = liftM concat $ many1 mathChunk
 
+mathChunk :: GenParser Char st [Char]
+mathChunk = do char '\\'
+               c <- anyChar
+               return ['\\',c]
+        <|> many1 (noneOf " \t\n\\$")
+
 math :: GenParser Char ParserState Inline
 math = (mathDisplay >>= return . Math DisplayMath)
      <|> (mathInline >>= return . Math InlineMath)
@@ -918,6 +981,12 @@
   notFollowedBy digit
   return $ intercalate " " words'
 
+-- to avoid performance problems, treat 4 or more _ or * in a row as a literal
+-- rather than attempting to parse for emph/strong
+fourOrMore :: Char -> GenParser Char st Inline
+fourOrMore c = try $ count 4 (char c) >> many (char c) >>= \s ->
+                       return (Str $ replicate 4 c ++ s)
+
 emph :: GenParser Char ParserState Inline
 emph = ((enclosed (char '*') (notFollowedBy' strong >> char '*') inline) <|>
         (enclosed (char '_') (notFollowedBy' strong >> char '_' >> 
@@ -1106,7 +1175,7 @@
   tit <- option "" linkTitle
   skipSpaces
   eof
-  return (intercalate "%20" $ words $ removeTrailingSpace src, tit)
+  return (intercalate "+" $ words $ removeTrailingSpace src, tit)
 
 linkTitle :: GenParser Char st String
 linkTitle = try $ do 
@@ -1167,8 +1236,8 @@
   state <- getState
   let notes = stateNotes state
   case lookup ref notes of
-    Nothing       -> fail "note not found"
-    Just contents -> return $ Note contents
+    Nothing   -> fail "note not found"
+    Just raw  -> liftM Note $ parseFromString parseBlocks raw
 
 inlineNote :: GenParser Char ParserState Inline
 inlineNote = try $ do
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -37,7 +37,9 @@
 import Data.List ( findIndex, delete, intercalate )
 
 -- | Parse reStructuredText string and return Pandoc document.
-readRST :: ParserState -> String -> Pandoc
+readRST :: ParserState -- ^ Parser state, including options for parser
+        -> String      -- ^ String to parse (assuming @'\n'@ line endings)
+        -> Pandoc
 readRST state s = (readWith parseRST) state (s ++ "\n\n")
 
 --
@@ -48,7 +50,7 @@
 bulletListMarkers = "*+-"
 
 underlineChars :: [Char]
-underlineChars = "!\"#$&'()*+,-./:;<=>?@[\\]^_`{|}~"
+underlineChars = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
 
 -- treat these as potentially non-text when parsing inline:
 specialChars :: [Char]
@@ -120,6 +122,7 @@
                , fieldList
                , blockQuote
                , imageBlock
+               , customCodeBlock
                , unknownDirective
                , header
                , hrule
@@ -171,7 +174,7 @@
               else do terms <- mapM (return . (:[]) . Str . fst) remaining
                       defs  <- mapM (parseFromString (many block) . snd) 
                                     remaining
-                      return $ DefinitionList $ zip terms defs
+                      return $ DefinitionList $ zip terms $ map (:[]) defs
 
 --
 -- line block
@@ -329,6 +332,16 @@
   result <- indentedBlock
   return $ CodeBlock ("",[],[]) $ stripTrailingNewlines result
 
+-- | The 'code-block' directive (from Sphinx) that allows a language to be
+-- specified.
+customCodeBlock :: GenParser Char st Block
+customCodeBlock = try $ do
+  string ".. code-block:: "
+  language <- manyTill anyChar newline
+  blanklines
+  result <- indentedBlock
+  return $ CodeBlock ("", ["sourceCode", language], []) $ stripTrailingNewlines result
+
 lhsCodeBlock :: GenParser Char ParserState Block
 lhsCodeBlock = try $ do
   failUnlessLHS
@@ -340,7 +353,7 @@
                 then map (drop 1) lns
                 else lns
   blanklines
-  return $ CodeBlock ("", ["sourceCode", "haskell"], []) $ intercalate "\n" lns'
+  return $ CodeBlock ("", ["sourceCode", "literate", "haskell"], []) $ intercalate "\n" lns'
 
 birdTrackLine :: GenParser Char st [Char]
 birdTrackLine = do
@@ -384,7 +397,7 @@
 list :: GenParser Char ParserState Block
 list = choice [ bulletList, orderedList, definitionList ] <?> "list"
 
-definitionListItem :: GenParser Char ParserState ([Inline], [Block])
+definitionListItem :: GenParser Char ParserState ([Inline], [[Block]])
 definitionListItem = try $ do
   -- avoid capturing a directive or comment
   notFollowedBy (try $ char '.' >> char '.')
@@ -392,7 +405,7 @@
   raw <- indentedBlock
   -- parse the extracted block, which may contain various block elements:
   contents <- parseFromString parseBlocks $ raw ++ "\n\n"
-  return (normalizeSpaces term, contents)
+  return (normalizeSpaces term, [contents])
 
 definitionList :: GenParser Char ParserState Block
 definitionList = many1 definitionListItem >>= return . DefinitionList
diff --git a/src/Text/Pandoc/Readers/TeXMath.hs b/src/Text/Pandoc/Readers/TeXMath.hs
--- a/src/Text/Pandoc/Readers/TeXMath.hs
+++ b/src/Text/Pandoc/Readers/TeXMath.hs
@@ -35,7 +35,8 @@
 import Text.Pandoc.Definition
 
 -- | Converts a string of raw TeX math to a list of 'Pandoc' inlines. 
-readTeXMath :: String -> [Inline]
+readTeXMath :: String    -- ^ String to parse (assumes @'\n'@ line endings)
+            -> [Inline]
 readTeXMath inp = case parse teXMath ("formula: " ++ inp) inp of
    Left _    -> [Str inp]  -- if unparseable, just include original
    Right res -> res
@@ -223,6 +224,7 @@
  ,("rceiling", "\x2309")
  ,("langle", "\x2329")
  ,("rangle", "\x232A")
+ ,("int", "\8747")
  ,("{", "{")
  ,("}", "}")
  ,("[", "[")
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -671,7 +671,8 @@
       stateSmart           :: Bool,          -- ^ Use smart typography?
       stateLiterateHaskell :: Bool,          -- ^ Treat input as literate haskell
       stateColumns         :: Int,           -- ^ Number of columns in terminal
-      stateHeaderTable     :: [HeaderType]   -- ^ Ordered list of header types used
+      stateHeaderTable     :: [HeaderType],  -- ^ Ordered list of header types used
+      stateIndentedCodeClasses :: [String]   -- ^ Classes to use for indented code blocks
     }
     deriving Show
 
@@ -695,7 +696,8 @@
                   stateSmart           = False,
                   stateLiterateHaskell = False,
                   stateColumns         = 80,
-                  stateHeaderTable     = [] }
+                  stateHeaderTable     = [],
+                  stateIndentedCodeClasses = [] }
 
 data HeaderType 
     = SingleHeader Char  -- ^ Single line of characters underneath
@@ -713,7 +715,7 @@
     | NoQuote         -- ^ Used when not parsing inside quotes
     deriving (Eq, Show)
 
-type NoteTable = [(String, [Block])]
+type NoteTable = [(String, String)]
 
 type KeyTable = [([Inline], Target)]
 
@@ -794,10 +796,12 @@
 prettyBlock (BulletList blockLists) = "BulletList\n" ++ 
   indentBy 2 0 ("[ " ++ (intercalate ", "
   (map (\blocks -> prettyBlockList 2 blocks) blockLists))) ++ " ]" 
-prettyBlock (DefinitionList blockLists) = "DefinitionList\n" ++ 
-  indentBy 2 0 ("[" ++ (intercalate ",\n"
-  (map (\(term, blocks) -> "  (" ++ show term ++ ",\n" ++ 
-  indentBy 1 2 (prettyBlockList 2 blocks) ++ "  )") blockLists))) ++ " ]" 
+prettyBlock (DefinitionList items) = "DefinitionList\n" ++ 
+  indentBy 2 0 ("[ " ++ (intercalate "\n, "
+  (map (\(term, defs) -> "(" ++ show term ++ ",\n" ++ 
+  indentBy 3 0 ("[ " ++ (intercalate ", "
+  (map (\blocks -> prettyBlockList 2 blocks) defs)) ++ "]") ++
+   ")") items))) ++ " ]" 
 prettyBlock (Table caption aligns widths header rows) = 
   "Table " ++ show caption ++ " " ++ show aligns ++ " " ++ 
   show widths ++ "\n" ++ prettyRow header ++ " [\n" ++  
@@ -856,34 +860,30 @@
                                 else lst
     in  removeLeading $ removeTrailing $ removeDoubles list
 
--- | Change final list item from @Para@ to @Plain@ if the list should 
--- be compact.
+-- | Change final list item from @Para@ to @Plain@ if the list contains
+-- no other @Para@ blocks.
 compactify :: [[Block]]  -- ^ List of list items (each a list of blocks)
            -> [[Block]]
 compactify [] = []
 compactify items =
-    let final  = last items
-        others = init items
-    in  case last final of
-          Para a  -> if all endsWithPlain others && not (null final)
-                        then others ++ [init final ++ [Plain a]]
-                        else items
-          _       -> items
+  case (init items, last items) of
+       (_,[])          -> items
+       (others, final) ->
+            case last final of
+                 Para a -> case (filter isPara $ concat items) of
+                                -- if this is only Para, change to Plain
+                                [_] -> others ++ [init final ++ [Plain a]]
+                                _   -> items
+                 _      -> items
 
-endsWithPlain :: [Block] -> Bool
-endsWithPlain [] = False
-endsWithPlain blocks =
-  case last blocks of
-       Plain _                  -> True
-       (BulletList (x:xs))      -> endsWithPlain $ last (x:xs)
-       (OrderedList _ (x:xs))   -> endsWithPlain $ last (x:xs)
-       (DefinitionList (x:xs))  -> endsWithPlain $ last $ map snd (x:xs)
-       _                        -> False
+isPara :: Block -> Bool
+isPara (Para _) = True
+isPara _        = False
 
 -- | Data structure for defining hierarchical Pandoc documents
 data Element = Blk Block 
-             | Sec Int String [Inline] [Element]
-             --    lvl  ident  label    contents
+             | Sec Int [Int] String [Inline] [Element]
+             --    lvl  num ident  label    contents
              deriving (Eq, Read, Show, Typeable, Data)
 
 -- | Convert Pandoc inline list to plain text identifier.
@@ -895,7 +895,7 @@
 inlineListToIdentifier' (x:xs) =
   xAsText ++ inlineListToIdentifier' xs
   where xAsText = case x of
-          Str s          -> filter (\c -> c == '-' || not (isPunctuation c)) $
+          Str s          -> filter (\c -> c `elem` "_-.~" || not (isPunctuation c)) $
                             intercalate "-" $ words $ map toLower s
           Emph lst       -> inlineListToIdentifier' lst
           Strikeout lst  -> inlineListToIdentifier' lst
@@ -921,18 +921,22 @@
 
 -- | Convert list of Pandoc blocks into (hierarchical) list of Elements
 hierarchicalize :: [Block] -> [Element]
-hierarchicalize blocks = S.evalState (hierarchicalizeWithIds blocks) []
+hierarchicalize blocks = S.evalState (hierarchicalizeWithIds blocks) ([],[])
 
-hierarchicalizeWithIds :: [Block] -> S.State [String] [Element]
+hierarchicalizeWithIds :: [Block] -> S.State ([Int],[String]) [Element]
 hierarchicalizeWithIds [] = return []
 hierarchicalizeWithIds ((Header level title'):xs) = do
-  usedIdents <- S.get
+  (lastnum, usedIdents) <- S.get
   let ident = uniqueIdent title' usedIdents
-  S.modify (ident :)
+  let lastnum' = take level lastnum
+  let newnum = if length lastnum' >= level
+                  then init lastnum' ++ [last lastnum' + 1] 
+                  else lastnum ++ replicate (level - length lastnum - 1) 0 ++ [1]
+  S.put (newnum, (ident : usedIdents))
   let (sectionContents, rest) = break (headerLtEq level) xs
   sectionContents' <- hierarchicalizeWithIds sectionContents
   rest' <- hierarchicalizeWithIds rest
-  return $ Sec level ident title' sectionContents' : rest'
+  return $ Sec level newnum ident title' sectionContents' : rest'
 hierarchicalizeWithIds (x:rest) = do
   rest' <- hierarchicalizeWithIds rest
   return $ (Blk x) : rest'
@@ -992,6 +996,7 @@
   , writerWrapText         :: Bool   -- ^ Wrap text to line length
   , writerLiterateHaskell  :: Bool   -- ^ Write as literate haskell
   , writerEmailObfuscation :: ObfuscationMethod -- ^ How to obfuscate emails
+  , writerIdentifierPrefix :: String -- ^ Prefix for section & note ids in HTML
   } deriving Show
 
 -- | Default writer options.
@@ -1014,6 +1019,7 @@
                 , writerWrapText         = True
                 , writerLiterateHaskell  = False
                 , writerEmailObfuscation = JavascriptObfuscation
+                , writerIdentifierPrefix = ""
                 }
 
 --
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -31,8 +31,9 @@
 import Text.Pandoc.Definition
 import Text.Pandoc.Shared
 import Text.Printf ( printf )
-import Data.List ( isSuffixOf, intercalate )
+import Data.List ( isSuffixOf, intercalate, intersperse )
 import Control.Monad.State
+import Control.Monad (liftM)
 import Text.PrettyPrint.HughesPJ hiding ( Str )
 
 data WriterState = 
@@ -192,15 +193,16 @@
                          text base <> char '{' <> contents <> char '}'
                     else contents
 blockToConTeXt (Table caption aligns widths heads rows) = do
-    let colWidths = map printDecimal widths
     let colDescriptor colWidth alignment = (case alignment of
                                                AlignLeft    -> 'l' 
                                                AlignRight   -> 'r'
                                                AlignCenter  -> 'c'
                                                AlignDefault -> 'l'):
-                                           "p(" ++ colWidth ++ "\\textwidth)|"
+           if colWidth == 0
+              then "|"
+              else ("p(" ++ printf "%.2f" colWidth ++ "\\textwidth)|")
     let colDescriptors = "|" ++ (concat $ 
-                                 zipWith colDescriptor colWidths aligns)
+                                 zipWith colDescriptor widths aligns)
     headers <- tableRowToConTeXt heads 
     captionText <- inlineListToConTeXt caption 
     let captionText' = if null caption then text "none" else captionText
@@ -210,9 +212,6 @@
              text "\\HL" $$ headers $$ text "\\HL" $$
              vcat rows' $$ text "\\HL\n\\stoptable"
 
-printDecimal :: Double  -> String
-printDecimal = printf "%.2f" 
-
 tableRowToConTeXt :: [[Block]] -> State WriterState Doc
 tableRowToConTeXt cols = do
   cols' <- mapM blockListToConTeXt cols
@@ -223,10 +222,10 @@
 listItemToConTeXt list = blockListToConTeXt list >>=
   return . (text "\\item" $$) . (nest 2)
 
-defListItemToConTeXt :: ([Inline], [Block]) -> State WriterState BlockWrapper
-defListItemToConTeXt (term, def) = do
+defListItemToConTeXt :: ([Inline], [[Block]]) -> State WriterState BlockWrapper
+defListItemToConTeXt (term, defs) = do
   term' <- inlineListToConTeXt term
-  def'  <- blockListToConTeXt def
+  def'  <- liftM (vcat . intersperse (text "")) $ mapM blockListToConTeXt defs
   return $ Pad $ text "\\startdescr{" <> term' <> char '}' $$ def' $$ text "\\stopdescr"
 
 -- | Convert list of block elements to ConTeXt.
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs
--- a/src/Text/Pandoc/Writers/Docbook.hs
+++ b/src/Text/Pandoc/Writers/Docbook.hs
@@ -82,12 +82,12 @@
 -- | Convert an Element to Docbook.
 elementToDocbook :: WriterOptions -> Element -> Doc
 elementToDocbook opts (Blk block) = blockToDocbook opts block 
-elementToDocbook opts (Sec _ _ title elements) =
+elementToDocbook opts (Sec _ _num id' title elements) =
   -- Docbook doesn't allow sections with no content, so insert some if needed
   let elements' = if null elements
                     then [Blk (Para [])]
                     else elements
-  in  inTagsIndented "section" $
+  in  inTags True "section" [("id",id')] $
       inTagsSimple "title" (wrap opts title) $$
       vcat (map (elementToDocbook opts) elements') 
 
@@ -102,14 +102,14 @@
 
 -- | Convert a list of pairs of terms and definitions into a list of 
 -- Docbook varlistentrys.
-deflistItemsToDocbook :: WriterOptions -> [([Inline],[Block])] -> Doc
+deflistItemsToDocbook :: WriterOptions -> [([Inline],[[Block]])] -> Doc
 deflistItemsToDocbook opts items = 
-  vcat $ map (\(term, def) -> deflistItemToDocbook opts term def) items
+  vcat $ map (\(term, defs) -> deflistItemToDocbook opts term defs) items
 
 -- | Convert a term and a list of blocks into a Docbook varlistentry.
-deflistItemToDocbook :: WriterOptions -> [Inline] -> [Block] -> Doc
-deflistItemToDocbook opts term def =
-  let def' = map plainToPara def
+deflistItemToDocbook :: WriterOptions -> [Inline] -> [[Block]] -> Doc
+deflistItemToDocbook opts term defs =
+  let def' = concatMap (map plainToPara) defs
   in  inTagsIndented "varlistentry" $
       inTagsIndented "term" (inlinesToDocbook opts term) $$
       inTagsIndented "listitem" (blocksToDocbook opts def')
@@ -262,7 +262,10 @@
                  then emailLink
                  else inlinesToDocbook opts txt <+> char '(' <> emailLink <> 
                       char ')'
-     else inTags False "ulink" [("url", src)] $ inlinesToDocbook opts txt
+     else (if isPrefixOf "#" src
+              then inTags False "link" [("linkend", drop 1 src)]
+              else inTags False "ulink" [("url", src)]) $
+          inlinesToDocbook opts txt
 inlineToDocbook _ (Image _ (src, tit)) = 
   let titleDoc = if null tit
                    then empty
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -35,9 +35,10 @@
 import Text.Pandoc.Shared
 import Text.Pandoc.Readers.TeXMath
 import Text.Pandoc.Highlighting ( highlightHtml, defaultHighlightingCss )
+import Text.Pandoc.XML (stripTags)
 import Numeric ( showHex )
 import Data.Char ( ord, toLower )
-import Data.List ( isPrefixOf, intercalate )
+import Data.List ( isPrefixOf, intersperse )
 import Data.Maybe ( catMaybes )
 import qualified Data.Set as S
 import Control.Monad.State
@@ -47,10 +48,11 @@
     { stNotes            :: [Html]       -- ^ List of notes
     , stMath             :: Bool         -- ^ Math is used in document
     , stCSS              :: S.Set String -- ^ CSS to include in header
+    , stSecNum           :: [Int]        -- ^ Number of current section
     } deriving Show
 
 defaultWriterState :: WriterState
-defaultWriterState = WriterState {stNotes= [], stMath = False, stCSS = S.empty}
+defaultWriterState = WriterState {stNotes= [], stMath = False, stCSS = S.empty, stSecNum = []}
 
 -- Helpers to render HTML with the appropriate function.
 
@@ -87,13 +89,13 @@
 writeHtml :: WriterOptions -> Pandoc -> Html
 writeHtml opts (Pandoc (Meta tit authors date) blocks) = 
   let titlePrefix = writerTitlePrefix opts
-      topTitle    = evalState (inlineListToHtml opts tit) defaultWriterState
-      topTitle'   = if null titlePrefix
-                       then topTitle
-                       else if null tit 
-                               then stringToHtml titlePrefix
-                               else titlePrefix +++ " - " +++ topTitle
-      metadata    = thetitle topTitle' +++ 
+      (topTitle,st) = runState (inlineListToHtml opts tit) defaultWriterState
+      topTitle''  = stripTags $ showHtmlFragment topTitle
+      topTitle'   = titlePrefix ++
+                    (if null topTitle'' || null titlePrefix
+                        then ""
+                        else " - ") ++ topTitle''
+      metadata    = thetitle << topTitle' +++
                     meta ! [httpequiv "Content-Type", 
                             content "text/html; charset=UTF-8"] +++
                     meta ! [name "generator", content "pandoc"] +++
@@ -108,17 +110,17 @@
                         else noHtml
       sects        = hierarchicalize blocks
       toc          = if writerTableOfContents opts 
-                        then evalState (tableOfContents opts sects) defaultWriterState
+                        then evalState (tableOfContents opts sects) st
                         else noHtml
-      (blocks', newstate) = runState 
-                            (mapM (elementToHtml opts) sects >>= return . toHtmlFromList)
-                            defaultWriterState
-      cssLines     = stCSS newstate
+      (blocks', st') = runState
+                       (mapM (elementToHtml opts) sects >>= return . toHtmlFromList)
+                       st
+      cssLines     = stCSS st'
       css          = if S.null cssLines
                         then noHtml
                         else style ! [thetype "text/css"] $ primHtml $
                              '\n':(unlines $ S.toList cssLines)
-      math         = if stMath newstate
+      math         = if stMath st'
                         then case writerHTMLMathMethod opts of
                                    LaTeXMathML Nothing -> 
                                       primHtml latexMathMLScript
@@ -134,7 +136,7 @@
                         else noHtml
       head'        = header $ metadata +++ math +++ css +++ 
                               primHtml (writerHeader opts)
-      notes        = reverse (stNotes newstate)
+      notes        = reverse (stNotes st')
       before       = primHtml $ writerIncludeBefore opts
       after        = primHtml $ writerIncludeAfter opts
       thebody      = before +++ titleHeader +++ toc +++ blocks' +++
@@ -143,36 +145,49 @@
          then head' +++ body thebody
          else thebody
 
+-- | Like Text.XHtml's identifier, but adds the writerIdentifierPrefix
+prefixedId :: WriterOptions -> String -> HtmlAttr
+prefixedId opts s = identifier $ writerIdentifierPrefix opts ++ s
+
 -- | Construct table of contents from list of elements.
 tableOfContents :: WriterOptions -> [Element] -> State WriterState Html
 tableOfContents _ [] = return noHtml
 tableOfContents opts sects = do
   let opts'        = opts { writerIgnoreNotes = True }
   contents  <- mapM (elementToListItem opts') sects
-  return $ thediv ! [identifier "TOC"] $ unordList $ catMaybes contents
+  return $ thediv ! [prefixedId opts' "TOC"] $ unordList $ catMaybes contents
 
+-- | Convert section number to string
+showSecNum :: [Int] -> String
+showSecNum = concat . intersperse "." . map show
+
 -- | Converts an Element to a list item for a table of contents,
 -- retrieving the appropriate identifier from state.
 elementToListItem :: WriterOptions -> Element -> State WriterState (Maybe Html)
 elementToListItem _ (Blk _) = return Nothing
-elementToListItem opts (Sec _ id' headerText subsecs) = do
-  txt <- inlineListToHtml opts headerText
+elementToListItem opts (Sec _ num id' headerText subsecs) = do
+  let sectnum = if writerNumberSections opts
+                   then (thespan ! [theclass "toc-section-number"] << showSecNum num) +++
+                         stringToHtml " "
+                   else noHtml
+  txt <- liftM (sectnum +++) $ inlineListToHtml opts headerText
   subHeads <- mapM (elementToListItem opts) subsecs >>= return . catMaybes
   let subList = if null subHeads
                    then noHtml
                    else unordList subHeads
-  return $ Just $ (anchor ! [href ("#" ++ id')] $ txt) +++ subList
+  return $ Just $ (anchor ! [href ("#" ++ writerIdentifierPrefix opts ++ id')] $ txt) +++ subList
 
 -- | Convert an Element to Html.
 elementToHtml :: WriterOptions -> Element -> State WriterState Html
 elementToHtml opts (Blk block) = blockToHtml opts block 
-elementToHtml opts (Sec level id' title' elements) = do
+elementToHtml opts (Sec level num id' title' elements) = do
   innerContents <- mapM (elementToHtml opts) elements
+  modify $ \st -> st{stSecNum = num}  -- update section number
   header' <- blockToHtml opts (Header level title')
   return $ if writerS5 opts || (writerStrictMarkdown opts && not (writerTableOfContents opts))
               -- S5 gets confused by the extra divs around sections
               then toHtmlFromList (header' : innerContents)
-              else thediv ! [identifier id'] << (header' : innerContents)
+              else thediv ! [prefixedId opts id'] << (header' : innerContents)
 
 -- | Convert list of Note blocks to a footnote <div>.
 -- Assumes notes are sorted.
@@ -248,20 +263,20 @@
 blockToHtml opts (Para lst) = inlineListToHtml opts lst >>= (return . paragraph)
 blockToHtml _ (RawHtml str) = return $ primHtml str
 blockToHtml _ (HorizontalRule) = return $ hr
-blockToHtml opts (CodeBlock (_,classes,_) rawCode) | "haskell" `elem` classes &&
-                                                          writerLiterateHaskell opts =
-  let classes' = map (\c -> if c == "haskell" then "literatehaskell" else c) classes
-  in  blockToHtml opts $ CodeBlock ("",classes',[]) $ intercalate "\n" $ map ("> " ++) $ lines rawCode
-blockToHtml _ (CodeBlock attr@(_,classes,_) rawCode) = do
-  case highlightHtml attr rawCode of
+blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do
+  let classes' = if writerLiterateHaskell opts
+                    then classes
+                    else filter (/= "literate") classes
+  case highlightHtml (id',classes',keyvals) rawCode of
          Left _  -> -- change leading newlines into <br /> tags, because some
                     -- browsers ignore leading newlines in pre blocks
                     let (leadingBreaks, rawCode') = span (=='\n') rawCode
-                    in  return $ pre ! (if null classes
-                                           then []
-                                           else [theclass $ unwords classes]) $ thecode <<
-                                                (replicate (length leadingBreaks) br +++
-                                                [stringToHtml $ rawCode' ++ "\n"])
+                        attrs = [theclass (unwords classes') | not (null classes')] ++
+                                [prefixedId opts id' | not (null id')] ++
+                                map (\(x,y) -> strAttr x y) keyvals
+                    in  return $ pre ! attrs $ thecode <<
+                                 (replicate (length leadingBreaks) br +++
+                                 [stringToHtml $ rawCode' ++ "\n"])
          Right h -> addToCSS defaultHighlightingCss >> return h
 blockToHtml opts (BlockQuote blocks) =
   -- in S5, treat list in blockquote specially
@@ -280,17 +295,22 @@
      else blockListToHtml opts blocks >>= (return . blockquote)
 blockToHtml opts (Header level lst) = do 
   contents <- inlineListToHtml opts lst
-  let contents'  = if writerTableOfContents opts
-                      then anchor ! [href "#TOC"] $ contents
-                      else contents
+  secnum <- liftM stSecNum get
+  let contents' = if writerNumberSections opts
+                     then (thespan ! [theclass "header-section-number"] << showSecNum secnum) +++
+                            stringToHtml " " +++ contents
+                     else contents
+  let contents''  = if writerTableOfContents opts
+                       then anchor ! [href $ "#" ++ writerIdentifierPrefix opts ++ "TOC"] $ contents'
+                       else contents'
   return $ case level of
-              1 -> h1 contents'
-              2 -> h2 contents'
-              3 -> h3 contents'
-              4 -> h4 contents'
-              5 -> h5 contents'
-              6 -> h6 contents'
-              _ -> paragraph contents'
+              1 -> h1 contents''
+              2 -> h2 contents''
+              3 -> h3 contents''
+              4 -> h4 contents''
+              5 -> h5 contents''
+              6 -> h6 contents''
+              _ -> paragraph contents''
 blockToHtml opts (BulletList lst) = do
   contents <- mapM (blockListToHtml opts) lst
   let attribs = if writerIncremental opts
@@ -311,13 +331,14 @@
                    else [])
   return $ ordList ! attribs $ contents
 blockToHtml opts (DefinitionList lst) = do
-  contents <- mapM (\(term, def) -> do term' <- inlineListToHtml opts term
-                                       def' <- blockListToHtml opts def
-                                       return $ (term', def')) lst
+  contents <- mapM (\(term, defs) ->
+                  do term' <- liftM (dterm <<) $ inlineListToHtml opts term
+                     defs' <- mapM (liftM (ddef <<) . blockListToHtml opts) defs
+                     return $ term' : defs') lst
   let attribs = if writerIncremental opts
                    then [theclass "incremental"]
                    else []
-  return $ defList ! attribs $ contents
+  return $ dlist ! attribs << concat contents
 blockToHtml opts (Table capt aligns widths headers rows') = do
   let alignStrings = map alignmentToString aligns
   captionDoc <- if null capt
@@ -464,9 +485,9 @@
                         htmlContents <- blockListToNote opts ref contents 
                         -- push contents onto front of notes
                         put $ st {stNotes = (htmlContents:notes)} 
-                        return $ anchor ! [href ("#fn" ++ ref),
+                        return $ anchor ! [href ("#" ++ writerIdentifierPrefix opts ++ "fn" ++ ref),
                                           theclass "footnoteRef",
-                                          identifier ("fnref" ++ ref)] << 
+                                          prefixedId opts ("fnref" ++ ref)] << 
                                           sup << ref
     (Cite _ il)  -> inlineListToHtml opts il
 
@@ -474,7 +495,7 @@
 blockListToNote opts ref blocks =
   -- If last block is Para or Plain, include the backlink at the end of
   -- that block. Otherwise, insert a new Plain block with the backlink.
-  let backlink = [HtmlInline $ " <a href=\"#fnref" ++ ref ++ 
+  let backlink = [HtmlInline $ " <a href=\"#" ++ writerIdentifierPrefix opts ++ "fnref" ++ ref ++ 
                  "\" class=\"footnoteBackLink\"" ++
                  " title=\"Jump back to footnote " ++ ref ++ "\">&#8617;</a>"]
       blocks'  = if null blocks
@@ -489,5 +510,5 @@
                                   _           -> otherBlocks ++ [lastBlock,
                                                  Plain backlink]
   in  do contents <- blockListToHtml opts blocks'
-         return $ li ! [identifier ("fn" ++ ref)] $ contents
+         return $ li ! [prefixedId opts ("fn" ++ ref)] $ contents
 
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -31,10 +31,11 @@
 import Text.Pandoc.Definition
 import Text.Pandoc.Shared
 import Text.Printf ( printf )
-import Data.List ( (\\), isSuffixOf, intercalate )
+import Data.List ( (\\), isSuffixOf, intercalate, intersperse )
 import Data.Char ( toLower )
 import qualified Data.Set as S
 import Control.Monad.State
+import Control.Monad (liftM)
 import Text.PrettyPrint.HughesPJ hiding ( Str )
 
 data WriterState = 
@@ -149,7 +150,8 @@
   return $ text "\\begin{quote}" $$ contents $$ text "\\end{quote}"
 blockToLaTeX (CodeBlock (_,classes,_) str) = do
   st <- get
-  env <- if writerLiterateHaskell (stOptions st) && "haskell" `elem` classes
+  env <- if writerLiterateHaskell (stOptions st) && "haskell" `elem` classes &&
+                    "literate" `elem` classes
             then return "code"
             else if stInNote st
                     then do addToHeader "\\usepackage{fancyvrb}"
@@ -187,26 +189,27 @@
 blockToLaTeX HorizontalRule = return $ text $
     "\\begin{center}\\rule{3in}{0.4pt}\\end{center}\n"
 blockToLaTeX (Header level lst) = do
-  txt <- inlineListToLaTeX (deVerb lst)
+  let lst' = deVerb lst
+  txt <- inlineListToLaTeX lst'
+  let noNote (Note _) = Str ""
+      noNote x        = x
+  let lstNoNotes = processWith noNote lst'
+  -- footnotes in sections don't work unless you specify an optional
+  -- argument:  \section[mysec]{mysec\footnote{blah}}
+  optional <- if lstNoNotes == lst'
+                 then return empty
+                 else do
+                   res <- inlineListToLaTeX lstNoNotes
+                   return $ char '[' <> res <> char ']'
   return $ if (level > 0) && (level <= 3)
               then text ("\\" ++ (concat (replicate (level - 1) "sub")) ++ 
-                   "section{") <> txt <> text "}\n"
+                   "section") <> optional <> char '{' <> txt <> text "}\n"
               else txt <> char '\n'
 blockToLaTeX (Table caption aligns widths heads rows) = do
   headers <- tableRowToLaTeX heads
   captionText <- inlineListToLaTeX caption
   rows' <- mapM tableRowToLaTeX rows
-  let colWidths = map (printf "%.2f") widths
-  let colDescriptors = concat $ zipWith
-                                (\width align -> ">{\\PBS" ++ 
-                                (case align of 
-                                       AlignLeft -> "\\raggedright"
-                                       AlignRight -> "\\raggedleft"
-                                       AlignCenter -> "\\centering"
-                                       AlignDefault -> "\\raggedright") ++
-                                "\\hspace{0pt}}p{" ++ width ++ 
-                                "\\columnwidth}")
-                                colWidths aligns
+  let colDescriptors = concat $ zipWith toColDescriptor widths aligns
   let tableBody = text ("\\begin{tabular}{" ++ colDescriptors ++ "}") $$
                   headers $$ text "\\hline" $$ vcat rows' $$ 
                   text "\\end{tabular}" 
@@ -220,6 +223,22 @@
               else text "\\begin{table}[h]" $$ centered tableBody $$ 
                    inCmd "caption" captionText $$ text "\\end{table}\n" 
 
+toColDescriptor :: Double -> Alignment -> String
+toColDescriptor 0 align =
+  case align of
+         AlignLeft    -> "l"
+         AlignRight   -> "r"
+         AlignCenter  -> "c"
+         AlignDefault -> "l"
+toColDescriptor width align = ">{\\PBS" ++
+  (case align of
+         AlignLeft -> "\\raggedright"
+         AlignRight -> "\\raggedleft"
+         AlignCenter -> "\\centering"
+         AlignDefault -> "\\raggedright") ++
+  "\\hspace{0pt}}p{" ++ printf "%.2f" width ++
+  "\\columnwidth}"
+
 blockListToLaTeX :: [Block] -> State WriterState Doc
 blockListToLaTeX lst = mapM blockToLaTeX lst >>= return . vcat
 
@@ -232,10 +251,10 @@
 listItemToLaTeX lst = blockListToLaTeX lst >>= return .  (text "\\item" $$) .
                       (nest 2)
 
-defListItemToLaTeX :: ([Inline], [Block]) -> State WriterState Doc
-defListItemToLaTeX (term, def) = do
+defListItemToLaTeX :: ([Inline], [[Block]]) -> State WriterState Doc
+defListItemToLaTeX (term, defs) = do
     term' <- inlineListToLaTeX $ deVerb term
-    def'  <- blockListToLaTeX def
+    def'  <- liftM (vcat . intersperse (text "")) $ mapM blockListToLaTeX defs
     return $ text "\\item[" <> term' <> text "]" $$ def'
 
 -- | Convert list of inline elements to LaTeX.
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -149,7 +149,7 @@
   contents <- liftM vcat $ mapM (wrapIfNeeded opts (inlineListToMan opts)) $
     splitSentences inlines
   return $ text ".PP" $$ contents 
-blockToMan _ (RawHtml str) = return $ text str
+blockToMan _ (RawHtml _) = return empty
 blockToMan _ HorizontalRule = return $ text $ ".PP\n   *   *   *   *   *"
 blockToMan opts (Header level inlines) = do
   contents <- inlineListToMan opts inlines
@@ -171,7 +171,9 @@
   in do
   caption' <- inlineListToMan opts caption
   modify (\(notes, preprocessors) -> (notes, "t":preprocessors))
-  let iwidths = map (printf "w(%0.2fn)" . (70 *)) widths 
+  let iwidths = if all (== 0) widths
+                   then repeat ""
+                   else map (printf "w(%0.2fn)" . (70 *)) widths
   -- 78n default width - 8n indent = 70n
   let coldescriptions = text $ intercalate " "
                         (zipWith (\align width -> aligncode align ++ width) 
@@ -240,19 +242,19 @@
 
 -- | Convert definition list item (label, list of blocks) to man.
 definitionListItemToMan :: WriterOptions
-                             -> ([Inline],[Block]) 
+                             -> ([Inline],[[Block]]) 
                              -> State WriterState Doc
-definitionListItemToMan opts (label, items) = do
+definitionListItemToMan opts (label, defs) = do
   labelText <- inlineListToMan opts label
-  contents <- if null items
+  contents <- if null defs 
                  then return empty
-                 else do 
-                        let (first, rest) = case items of
+                 else liftM vcat $ forM defs $ \blocks -> do 
+                        let (first, rest) = case blocks of
                               ((Para x):y) -> (Plain x,y)
                               (x:y)        -> (x,y)
-                              []           -> error "items is null"
-                        rest' <- mapM (\item -> blockToMan opts item)
-                                 rest >>= (return . vcat)
+                              []           -> error "blocks is null"
+                        rest' <- liftM vcat $
+                                  mapM (\item -> blockToMan opts item) rest
                         first' <- blockToMan opts first
                         return $ first' $$ text ".RS" $$ rest' $$ text ".RE"
   return $ text ".TP\n.B " <> labelText $+$ contents
@@ -310,7 +312,7 @@
   contents <- inlineToMan opts (Code str)
   return $ text ".RS" $$ contents $$ text ".RE"
 inlineToMan _ (TeX _) = return empty
-inlineToMan _ (HtmlInline str) = return $ text $ escapeCode str 
+inlineToMan _ (HtmlInline _) = return empty
 inlineToMan _ (LineBreak) = return $ text "\n.PD 0\n.P\n.PD\n"
 inlineToMan _ Space = return $ char ' '
 inlineToMan opts (Link txt (src, _)) = do
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -34,7 +34,7 @@
 import Text.Pandoc.Shared 
 import Text.Pandoc.Blocks
 import Text.ParserCombinators.Parsec ( parse, GenParser )
-import Data.List ( group, isPrefixOf, drop, find, intersperse, intercalate )
+import Data.List ( group, isPrefixOf, drop, find, intersperse, intercalate, transpose )
 import Text.PrettyPrint.HughesPJ hiding ( Str )
 import Control.Monad.State
 
@@ -138,7 +138,7 @@
 -- | Converts an Element to a list item for a table of contents,
 elementToListItem :: Element -> [Block]
 elementToListItem (Blk _) = []
-elementToListItem (Sec _ _ headerText subsecs) = [Plain headerText] ++ 
+elementToListItem (Sec _ _ _ headerText subsecs) = [Plain headerText] ++ 
   if null subsecs
      then []
      else [BulletList $ map elementToListItem subsecs]
@@ -198,6 +198,7 @@
                             _  -> empty
      else return $ text ((replicate level '#') ++ " ") <> contents <> text "\n"
 blockToMarkdown opts (CodeBlock (_,classes,_) str) | "haskell" `elem` classes &&
+                                                     "literate" `elem` classes &&
                                                      writerLiterateHaskell opts =
   return $ (vcat $ map (text "> " <>) $ map text (lines str)) <> text "\n"
 blockToMarkdown opts (CodeBlock _ str) = return $
@@ -217,25 +218,29 @@
                      then empty
                      else text "" $+$ (text "Table: " <> caption')
   headers' <- mapM (blockListToMarkdown opts) headers
-  let widthsInChars = map (floor . (78 *)) widths
   let alignHeader alignment = case alignment of
                                 AlignLeft    -> leftAlignBlock
                                 AlignCenter  -> centerAlignBlock
                                 AlignRight   -> rightAlignBlock
                                 AlignDefault -> leftAlignBlock  
+  rawRows <- mapM (mapM (blockListToMarkdown opts)) rows
+  let isSimple = all (==0) widths
+  let numChars = maximum . map (length . render)
+  let widthsInChars =
+       if isSimple
+          then map ((+2) . numChars) $ transpose (headers' : rawRows)
+          else map (floor . (78 *)) widths
   let makeRow = hsepBlocks . (zipWith alignHeader aligns) . 
                 (zipWith docToBlock widthsInChars)
   let head' = makeRow headers'
-  rows' <- mapM (\row -> do cols <- mapM (blockListToMarkdown opts) row
-                            return $ makeRow cols) rows
+  let rows' = map makeRow rawRows
   let maxRowHeight = maximum $ map heightOfBlock (head':rows')
-  let isMultilineTable = maxRowHeight > 1
   let underline = hsep $ 
                   map (\width -> text $ replicate width '-') widthsInChars
-  let border = if isMultilineTable
+  let border = if maxRowHeight > 1
                   then text $ replicate (sum widthsInChars + (length widthsInChars - 1)) '-'
                   else empty
-  let spacer = if isMultilineTable
+  let spacer = if maxRowHeight > 1
                   then text ""
                   else empty
   let body = vcat $ intersperse spacer $ map blockToDoc rows'
@@ -274,15 +279,14 @@
 
 -- | Convert definition list item (label, list of blocks) to markdown.
 definitionListItemToMarkdown :: WriterOptions
-                             -> ([Inline],[Block]) 
+                             -> ([Inline],[[Block]]) 
                              -> State WriterState Doc
-definitionListItemToMarkdown opts (label, items) = do
+definitionListItemToMarkdown opts (label, defs) = do
   labelText <- inlineListToMarkdown opts label
   let tabStop = writerTabStop opts
   let leader  = char ':'
-  contents <- mapM (\item -> blockToMarkdown opts item >>= 
-                   (\txt -> return (leader $$ nest tabStop txt)))
-                   items >>= return . vcat
+  contents <- liftM vcat $
+    mapM (liftM ((leader $$) . nest tabStop . vcat) . mapM (blockToMarkdown opts))           defs
   return $ labelText $+$ contents
 
 -- | Convert list of Pandoc block elements to markdown.
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -33,7 +33,7 @@
 import Text.Pandoc.Definition
 import Text.Pandoc.Shared 
 import Text.Pandoc.XML ( escapeStringForXML )
-import Data.List ( intersect )
+import Data.List ( intersect, intercalate )
 import Network.URI ( isURI )
 import Control.Monad.State
 
@@ -141,7 +141,7 @@
         modify $ \s -> s { stListLevel = stListLevel s ++ "*" }
         contents <- mapM (listItemToMediaWiki opts) items
         modify $ \s -> s { stListLevel = init (stListLevel s) }
-        return $ vcat contents
+        return $ vcat contents ++ "\n"
 
 blockToMediaWiki opts x@(OrderedList attribs items) = do
   oldUseTags <- get >>= return . stUseTags
@@ -156,7 +156,7 @@
         modify $ \s -> s { stListLevel = stListLevel s ++ "#" }
         contents <- mapM (listItemToMediaWiki opts) items
         modify $ \s -> s { stListLevel = init (stListLevel s) }
-        return $ vcat contents
+        return $ vcat contents ++ "\n"
 
 blockToMediaWiki opts x@(DefinitionList items) = do
   oldUseTags <- get >>= return . stUseTags
@@ -171,7 +171,7 @@
         modify $ \s -> s { stListLevel = stListLevel s ++ ";" }
         contents <- mapM (definitionListItemToMediaWiki opts) items
         modify $ \s -> s { stListLevel = init (stListLevel s) }
-        return $ vcat contents
+        return $ vcat contents ++ "\n"
 
 -- Auxiliary functions for lists:
 
@@ -199,17 +199,19 @@
 
 -- | Convert definition list item (label, list of blocks) to MediaWiki.
 definitionListItemToMediaWiki :: WriterOptions
-                             -> ([Inline],[Block]) 
+                             -> ([Inline],[[Block]]) 
                              -> State WriterState String
 definitionListItemToMediaWiki opts (label, items) = do
   labelText <- inlineListToMediaWiki opts label
-  contents <- blockListToMediaWiki opts items
+  contents <- mapM (blockListToMediaWiki opts) items
   useTags <- get >>= return . stUseTags
   if useTags
-     then return $ "<dt>" ++ labelText ++ "</dt>\n<dd>" ++ contents ++ "</dd>"
+     then return $ "<dt>" ++ labelText ++ "</dt>\n" ++
+           (intercalate "\n" $ map (\d -> "<dd>" ++ d ++ "</dd>") contents)
      else do
        marker <- get >>= return . stListLevel
-       return $ marker ++ " " ++ labelText ++ "\n" ++ (init marker ++ ": ") ++  contents
+       return $ marker ++ " " ++ labelText ++ "\n" ++
+           (intercalate "\n" $ map (\d -> init marker ++ ": " ++ d) contents)
 
 -- | True if the list can be handled by simple wiki markup, False if HTML tags will be needed.
 isSimpleList :: Block -> Bool
@@ -218,7 +220,7 @@
        BulletList items                 -> all isSimpleListItem items
        OrderedList (num, sty, _) items  -> all isSimpleListItem items &&
                                             num == 1 && sty `elem` [DefaultStyle, Decimal]
-       DefinitionList items             -> all isSimpleListItem $ map snd items 
+       DefinitionList items             -> all isSimpleListItem $ concatMap snd items 
        _                                -> False
 
 -- | True if list item can be handled with the simple wiki syntax.  False if
@@ -251,9 +253,7 @@
 
 -- | Concatenates strings with line breaks between them.
 vcat :: [String] -> String
-vcat []     = ""
-vcat [x]    = x
-vcat (x:xs) = x ++ "\n" ++ vcat xs
+vcat = intercalate "\n"
 
 -- Auxiliary functions for tables:
 
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -260,14 +260,14 @@
 listItemsToOpenDocument s o is =
     vcat . map (inTagsIndented "text:list-item") <$> mapM (withParagraphStyle o s . map plainToPara) is
 
-deflistItemToOpenDocument :: WriterOptions -> ([Inline],[Block]) -> State WriterState Doc
+deflistItemToOpenDocument :: WriterOptions -> ([Inline],[[Block]]) -> State WriterState Doc
 deflistItemToOpenDocument o (t,d) = do
-  let ts = if isTightList [d]
+  let ts = if isTightList d
            then "Definition_20_Term_20_Tight"       else "Definition_20_Term"
-      ds = if isTightList [d]
+      ds = if isTightList d
            then "Definition_20_Definition_20_Tight" else "Definition_20_Definition"
   t' <- withParagraphStyle o ts [Para t]
-  d' <- withParagraphStyle o ds (map plainToPara d)
+  d' <- liftM vcat $ mapM (withParagraphStyle o ds . (map plainToPara)) d
   return $ t' $$ d'
 
 inBlockQuote :: WriterOptions -> Int -> [Block] -> State WriterState Doc
@@ -467,13 +467,15 @@
         table          = inTags True "style:style"
                          [("style:name", tableId)] $
                          selfClosingTag "style:table-properties"
-                         [ ("style:rel-width", "100%"  )
-                         , ("table:align"    , "center")]
+                         [("table:align"    , "center")]
+        colStyle (c,0) = selfClosingTag "style:style"
+                         [ ("style:name"  , tableId ++ "." ++ [c])
+                         , ("style:family", "table-column"       )]
         colStyle (c,w) = inTags True "style:style"
                          [ ("style:name"  , tableId ++ "." ++ [c])
                          , ("style:family", "table-column"       )] $
                          selfClosingTag "style:table-column-properties"
-                         [("style:column-width", printf "%.2f" (7 * w) ++ "in")]
+                         [("style:rel-column-width", printf "%d*" $ (floor $ w * 65535 :: Integer))]
         cellStyle      = inTags True "style:style"
                          [ ("style:name"  , tableId ++ ".A1")
                          , ("style:family", "table-cell"    )] $
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -33,7 +33,7 @@
 import Text.Pandoc.Definition
 import Text.Pandoc.Shared 
 import Text.Pandoc.Blocks
-import Data.List ( isPrefixOf, isSuffixOf, drop, intersperse )
+import Data.List ( isPrefixOf, isSuffixOf, drop, intersperse, transpose )
 import Text.PrettyPrint.HughesPJ hiding ( Str )
 import Control.Monad.State
 import Control.Applicative ( (<$>) )
@@ -183,7 +183,8 @@
 blockToRST (CodeBlock (_,classes,_) str) = do
   opts <- stOptions <$> get
   let tabstop = writerTabStop opts
-  if "haskell" `elem` classes && writerLiterateHaskell opts
+  if "haskell" `elem` classes && "literate" `elem` classes &&
+                  writerLiterateHaskell opts
      then return $ (vcat $ map (text "> " <>) $ map text (lines str)) <> text "\n"
      else return $ (text "::\n") $+$
                    (nest tabstop $ vcat $ map text (lines str)) <> text "\n"
@@ -197,7 +198,13 @@
                      then empty
                      else text "" $+$ (text "Table: " <> caption')
   headers' <- mapM blockListToRST headers
-  let widthsInChars = map (floor . (78 *)) widths
+  rawRows <- mapM (mapM blockListToRST) rows
+  let isSimple = all (==0) widths && all (all (\bs -> length bs == 1)) rows
+  let numChars = maximum . map (length . render)
+  let widthsInChars =
+       if isSimple
+          then map ((+2) . numChars) $ transpose (headers' : rawRows)
+          else map (floor . (78 *)) widths
   let hpipeBlocks blocks = hcatBlocks [beg, middle, end] 
         where height = maximum (map heightOfBlock blocks)
               sep'   = TextBlock 3 height (replicate height " | ")
@@ -250,10 +257,10 @@
   return $ (text marker <> char ' ') <> contents 
 
 -- | Convert defintion list item (label, list of blocks) to RST.
-definitionListItemToRST :: ([Inline], [Block]) -> State WriterState Doc
-definitionListItemToRST (label, items) = do
+definitionListItemToRST :: ([Inline], [[Block]]) -> State WriterState Doc
+definitionListItemToRST (label, defs) = do
   label' <- inlineListToRST label
-  contents <- blockListToRST items
+  contents <- liftM vcat $ mapM blockListToRST defs
   tabstop <- get >>= (return . writerTabStop . stOptions)
   return $ label' $+$ nest tabstop contents
 
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -59,7 +59,7 @@
 
 elementToListItem :: Element -> [Block]
 elementToListItem (Blk _) = []
-elementToListItem (Sec _ _ sectext subsecs) = [Plain sectext] ++
+elementToListItem (Sec _ _ _ sectext subsecs) = [Plain sectext] ++
   if null subsecs
      then []
      else [BulletList (map elementToListItem subsecs)]
@@ -191,9 +191,12 @@
   rtfPar indent 0 alignment (inlineListToRTF caption)
 
 tableRowToRTF :: Bool -> Int -> [Alignment] -> [Double] -> [[Block]] -> String
-tableRowToRTF header indent aligns sizes cols =
-  let columns = concat $ zipWith (tableItemToRTF indent) aligns cols
-      totalTwips = 6 * 1440 -- 6 inches
+tableRowToRTF header indent aligns sizes' cols =
+  let totalTwips = 6 * 1440 -- 6 inches
+      sizes = if all (== 0) sizes'
+                 then take (length cols) $ repeat (1.0 / fromIntegral (length cols))
+                 else sizes'
+      columns = concat $ zipWith (tableItemToRTF indent) aligns cols
       rightEdges = tail $ scanl (\sofar new -> sofar + floor (new * totalTwips))
                                 (0 :: Integer) sizes
       cellDefs = map (\edge -> (if header
@@ -244,11 +247,12 @@
 -- | Convert definition list item (label, list of blocks) to RTF.
 definitionListItemToRTF :: Alignment          -- ^ alignment
                         -> Int                -- ^ indent level
-                        -> ([Inline],[Block]) -- ^ list item (list of blocks)
+                        -> ([Inline],[[Block]]) -- ^ list item (list of blocks)
                         -> [Char]
-definitionListItemToRTF alignment indent (label, items) =
+definitionListItemToRTF alignment indent (label, defs) =
   let labelText = blockToRTF indent alignment (Plain label)
-      itemsText = concatMap (blockToRTF (indent + listIncrement) alignment) items
+      itemsText = concatMap (blockToRTF (indent + listIncrement) alignment) $
+                    concat defs
   in  labelText ++ itemsText 
 
 -- | Convert list of inline items to RTF.
diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs
--- a/src/Text/Pandoc/Writers/Texinfo.hs
+++ b/src/Text/Pandoc/Writers/Texinfo.hs
@@ -32,7 +32,8 @@
 import Text.Pandoc.Shared
 import Text.Pandoc.Readers.TeXMath
 import Text.Printf ( printf )
-import Data.List ( isSuffixOf )
+import Data.List ( isSuffixOf, transpose, maximumBy )
+import Data.Ord ( comparing )
 import Data.Char ( chr, ord )
 import qualified Data.Set as S
 import Control.Monad.State
@@ -104,8 +105,10 @@
                      then empty 
                      else text $ stringToTexinfo date
 
-  let baseHeader = text $ writerHeader options
-  let header     = baseHeader $$ extras
+  let baseHeader = case writerHeader options of
+                         ""  -> empty
+                         x   -> text x
+  let header     = text "@documentencoding utf-8" $$ baseHeader $$ extras
   return $ text "\\input texinfo" $$
            header $$
 	   text "@ifnottex" $$
@@ -223,9 +226,14 @@
   headers <- tableHeadToTexinfo aligns heads
   captionText <- inlineListToTexinfo caption
   rowsText <- mapM (tableRowToTexinfo aligns) rows
-  let colWidths = map (printf "%.2f ") widths
-  let colDescriptors = concat colWidths
-  let tableBody = text ("@multitable @columnfractions " ++ colDescriptors) $$
+  colDescriptors <-
+    if all (== 0) widths
+       then do -- use longest entry instead of column widths
+            cols <- mapM (mapM (liftM (render . hcat) . mapM blockToTexinfo)) $
+                       transpose $ heads : rows
+            return $ concatMap ((\x -> "{"++x++"} ") .  maximumBy (comparing length)) cols
+       else return $ "@columnfractions " ++ concatMap (printf "%.2f ") widths
+  let tableBody = text ("@multitable " ++ colDescriptors) $$
                   headers $$
                   vcat rowsText $$ 
                   text "@end multitable" 
@@ -331,11 +339,11 @@
 listItemToTexinfo lst = blockListToTexinfo lst >>=
                         return . (text "@item" $$) 
 
-defListItemToTexinfo :: ([Inline], [Block])
+defListItemToTexinfo :: ([Inline], [[Block]])
                      -> State WriterState Doc
-defListItemToTexinfo (term, def) = do
+defListItemToTexinfo (term, defs) = do
     term' <- inlineListToTexinfo term
-    def'  <- blockListToTexinfo def
+    def'  <- liftM vcat $ mapM blockListToTexinfo defs
     return $ text "@item " <> term' <> text "\n" $$ def'
 
 -- | Convert list of inline elements to Texinfo.
diff --git a/src/Text/Pandoc/XML.hs b/src/Text/Pandoc/XML.hs
--- a/src/Text/Pandoc/XML.hs
+++ b/src/Text/Pandoc/XML.hs
@@ -27,13 +27,24 @@
 
 Functions for escaping and formatting XML.
 -}
-module Text.Pandoc.XML ( escapeCharForXML,
+module Text.Pandoc.XML ( stripTags,
+                         escapeCharForXML,
                          escapeStringForXML,
                          inTags,
                          selfClosingTag,
                          inTagsSimple,
                          inTagsIndented  ) where
 import Text.PrettyPrint.HughesPJ
+
+-- | Remove everything between <...>
+stripTags :: String -> String
+stripTags ('<':xs) =
+  let (_,rest) = break (=='>') xs
+  in  if null rest
+         then ""
+         else stripTags (tail rest) -- leave off >
+stripTags (x:xs) = x : stripTags xs
+stripTags [] = []
 
 -- | Escape one character as needed for XML.
 escapeCharForXML :: Char -> String
diff --git a/src/markdown2pdf.hs b/src/markdown2pdf.hs
--- a/src/markdown2pdf.hs
+++ b/src/markdown2pdf.hs
@@ -1,18 +1,20 @@
 module Main where
 
-import Data.List (isInfixOf, intercalate, (\\))
+import Data.List (isInfixOf, intercalate, isPrefixOf)
 import Data.Maybe (isNothing)
 
-import Control.Monad (when, unless, guard)
+import Control.Monad (unless, guard)
 import Control.Exception (tryJust, bracket)
 
-import System.IO (stderr, hPutStrLn)
+import System.IO (stderr)
 import System.IO.Error (isDoesNotExistError)
+import System.Environment ( getArgs, getProgName )
+import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents )
+import System.IO.UTF8
 import System.Exit (ExitCode (..), exitWith)
 import System.FilePath
 import System.Directory
 import System.Process (readProcessWithExitCode)
-import System.Environment (getArgs, getProgName)
 
 
 run :: FilePath -> [String] -> IO (Either String String)
@@ -62,12 +64,12 @@
 runLatex :: FilePath -> IO (Either String FilePath)
 runLatex file = step 3
   where
-  step 0 = return $ Left "Limit of attempts reached"
   step n = do
     result <- runLatexRaw file
     case result of
       Left (Left err) -> return $ Left err
-      Left (Right _ ) -> step (n-1 :: Int)
+      Left (Right _) | n > 1  -> step (n-1 :: Int)
+      Left (Right msg) -> return $ Left msg
       Right pdfFile   -> return $ Right pdfFile
 
 checkLatex :: String -> (Bool, Bool, Bool, String)
@@ -127,13 +129,8 @@
 
 saveOutput :: FilePath -> FilePath -> IO ()
 saveOutput input output = do
-  outputExist <- doesFileExist output
-  when outputExist $ do
-    let output' = output ++ "~"
-    renameFile output output'
-    putStrLn $! "Created backup file " ++ output'
   copyFile input output
-  putStrLn $! "Created " ++ output
+  hPutStrLn stderr $! "Created " ++ output
 
 main :: IO ()
 main = bracket
@@ -155,21 +152,26 @@
     unless (null miss) $ exit $! "Could not find " ++ intercalate ", " miss
     args <- getArgs
     -- check for invalid arguments and print help message if needed
-    let goodopts = ["-f","-r","--from","--read","--strict","-N",
-                   "-p","--preserve-tabs","--tab-stop","-R","--parse-raw",
+    let goodopts = ["-f","-r","-N", "-p","-R","-H","-B","-A", "-C","-o"]
+    let goodoptslong = ["--from","--read","--strict",
+                   "--preserve-tabs","--tab-stop","--parse-raw",
                    "--toc","--table-of-contents",
-                   "--number-sections","-H","--include-in-header",
-                   "-B","--include-before-body","-A","--include-after-body",
-                   "-C","--custom-header","-o","--output"]
-    let goodoptsLong = filter (\op -> length op > 2) goodopts
+                   "--number-sections","--include-in-header",
+                   "--include-before-body","--include-after-body",
+                   "--custom-header","--output"]
     let isOpt ('-':_) = True
         isOpt _       = False
-    unless (null (filter isOpt args \\ goodopts)) $ do
+    let opts = filter isOpt args
+    -- note that a long option can come in this form: --opt=val
+    let isGoodopt x = x `elem` (goodopts ++ goodoptslong) ||
+                      any (\o -> (o ++ "=") `isPrefixOf` x) goodoptslong
+    unless (all isGoodopt opts) $ do
       (code, out, _err) <- readProcessWithExitCode "pandoc" ["--help"] ""
       putStrLn "markdown2pdf [OPTIONS] [FILES]\nOptions:"
       putStr $ unlines $
-               filter (\l -> any (`isInfixOf` l) goodoptsLong) $ lines out
+               filter (\l -> any (`isInfixOf` l) goodoptslong) $ lines out
       exitWith code
+
     -- parse arguments
     -- if no input given, use 'stdin'
     pandocArgs <- parsePandocArgs args
diff --git a/src/pandoc.hs b/src/pandoc.hs
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -153,6 +153,8 @@
     , optSanitizeHTML      :: Bool    -- ^ Sanitize HTML
     , optPlugins           :: [Pandoc -> IO Pandoc] -- ^ Plugins to apply
     , optEmailObfuscation  :: ObfuscationMethod
+    , optIdentifierPrefix  :: String
+    , optIndentedCodeClasses :: [String] -- ^ Default classes for indented code blocks
 #ifdef _CITEPROC
     , optBiblioFile        :: String
     , optBiblioFormat      :: String
@@ -189,6 +191,8 @@
     , optSanitizeHTML      = False
     , optPlugins           = []
     , optEmailObfuscation  = JavascriptObfuscation
+    , optIdentifierPrefix  = ""
+    , optIndentedCodeClasses = []
 #ifdef _CITEPROC
     , optBiblioFile        = []
     , optBiblioFormat      = []
@@ -312,6 +316,19 @@
                   "none|javascript|references")
                  "" -- "Method for obfuscating email in HTML"
 
+     , Option "" ["id-prefix"]
+                  (ReqArg
+                   (\arg opt -> return opt { optIdentifierPrefix = arg })
+                   "STRING")
+                  "" -- "Prefix to add to automatically generated HTML identifiers"
+
+     , Option "" ["indented-code-classes"]
+                  (ReqArg
+                   (\arg opt -> return opt { optIndentedCodeClasses = words $
+                                             map (\c -> if c == ',' then ' ' else c) arg })
+                   "STRING")
+                  "" -- "Classes (whitespace- or comma-separated) to use for indented code-blocks"
+
     , Option "" ["toc", "table-of-contents"]
                 (NoArg
                  (\opt -> return opt { optTableOfContents = True }))
@@ -531,6 +548,8 @@
               , optWrapText          = wrap
               , optSanitizeHTML      = sanitize
               , optEmailObfuscation  = obfuscationMethod
+              , optIdentifierPrefix  = idPrefix
+              , optIndentedCodeClasses = codeBlockClasses
 #ifdef _CITEPROC
               , optBiblioFile         = biblioFile
               , optBiblioFormat       = biblioFormat
@@ -586,7 +605,8 @@
                               stateSmart           = smart || writerName' `elem`
                                                               ["latex", "context", "man"],
                               stateColumns         = columns,
-                              stateStrict          = strict }
+                              stateStrict          = strict,
+                              stateIndentedCodeClasses = codeBlockClasses }
   let csslink = if null css
                    then ""
                    else concatMap
@@ -616,7 +636,8 @@
                                                                lhsExtension [outputFile],
                                       writerEmailObfuscation = if strict
                                                                   then ReferenceObfuscation
-                                                                  else obfuscationMethod }
+                                                                  else obfuscationMethod,
+                                      writerIdentifierPrefix = idPrefix }
 
   when (isNonTextOutput writerName' && outputFile == "-") $
     do hPutStrLn stderr ("Error:  Cannot write " ++ writerName ++ " output to stdout.\n" ++
diff --git a/tests/html-reader.native b/tests/html-reader.native
--- a/tests/html-reader.native
+++ b/tests/html-reader.native
@@ -181,12 +181,13 @@
 , HorizontalRule
 , Header 2 [Str "Definition"]
 , DefinitionList
-  [  ([Str "Violin"],
-     [ Plain [Str "Stringed",Space,Str "musical",Space,Str "instrument."]
-     , Plain [Str "Torture",Space,Str "device."] ]  ),
-    ([Str "Cello",LineBreak,Str "Violoncello"],
-     [ Plain [Str "Low-voiced",Space,Str "stringed",Space,Str "instrument."] ]
-    ) ]
+  [ ([Str "Violin"],
+     [ [ Plain [Str "Stringed",Space,Str "musical",Space,Str "instrument."] ]
+     , [ Plain [Str "Torture",Space,Str "device."] ]
+     ])
+  , ([Str "Cello",LineBreak,Str "Violoncello"],
+     [ [ Plain [Str "Low-voiced",Space,Str "stringed",Space,Str "instrument."] ]
+     ]) ]
 , HorizontalRule
 , Header 1 [Str "HTML",Space,Str "Blocks"]
 , Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
diff --git a/tests/latex-reader.native b/tests/latex-reader.native
--- a/tests/latex-reader.native
+++ b/tests/latex-reader.native
@@ -185,48 +185,48 @@
 , Header 1 [Str "Definition",Space,Str "Lists"]
 , Para [Str "Tight",Space,Str "using",Space,Str "spaces:"]
 , DefinitionList
-  [  ([Str "apple"],
-     [ Para [Str "red",Space,Str "fruit"] ]
-    ),
-    ([Str "orange"],
-     [ Para [Str "orange",Space,Str "fruit"] ]
-    ),
-    ([Str "banana"],
-     [ Para [Str "yellow",Space,Str "fruit"] ]
-    ) ]
+  [ ([Str "apple"],
+     [ [ Para [Str "red",Space,Str "fruit"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Para [Str "orange",Space,Str "fruit"] ]
+     ])
+  , ([Str "banana"],
+     [ [ Para [Str "yellow",Space,Str "fruit"] ]
+     ]) ]
 , Para [Str "Tight",Space,Str "using",Space,Str "tabs:"]
 , DefinitionList
-  [  ([Str "apple"],
-     [ Para [Str "red",Space,Str "fruit"] ]
-    ),
-    ([Str "orange"],
-     [ Para [Str "orange",Space,Str "fruit"] ]
-    ),
-    ([Str "banana"],
-     [ Para [Str "yellow",Space,Str "fruit"] ]
-    ) ]
+  [ ([Str "apple"],
+     [ [ Para [Str "red",Space,Str "fruit"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Para [Str "orange",Space,Str "fruit"] ]
+     ])
+  , ([Str "banana"],
+     [ [ Para [Str "yellow",Space,Str "fruit"] ]
+     ]) ]
 , Para [Str "Loose:"]
 , DefinitionList
-  [  ([Str "apple"],
-     [ Para [Str "red",Space,Str "fruit"] ]
-    ),
-    ([Str "orange"],
-     [ Para [Str "orange",Space,Str "fruit"] ]
-    ),
-    ([Str "banana"],
-     [ Para [Str "yellow",Space,Str "fruit"] ]
-    ) ]
+  [ ([Str "apple"],
+     [ [ Para [Str "red",Space,Str "fruit"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Para [Str "orange",Space,Str "fruit"] ]
+     ])
+  , ([Str "banana"],
+     [ [ Para [Str "yellow",Space,Str "fruit"] ]
+     ]) ]
 , Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
 , DefinitionList
-  [  ([Emph [Str "apple"]],
-     [ Para [Str "red",Space,Str "fruit"]
-     , Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"] ]  ),
-    ([Emph [Str "orange"]],
-     [ Para [Str "orange",Space,Str "fruit"]
-     , CodeBlock ("",[],[]) "{ orange code block }"
-     , BlockQuote
-       [ Para [Str "orange",Space,Str "block",Space,Str "quote"] ]
-      ]  ) ]
+  [ ([Emph [Str "apple"]],
+     [ [ Para [Str "red",Space,Str "fruit"]
+       , Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"] ]])
+  , ([Emph [Str "orange"]],
+     [ [ Para [Str "orange",Space,Str "fruit"]
+       , CodeBlock ("",[],[]) "{ orange code block }"
+       , BlockQuote
+         [ Para [Str "orange",Space,Str "block",Space,Str "quote"] ]
+        ]]) ]
 , Header 1 [Str "HTML",Space,Str "Blocks"]
 , Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
 , Para [Str "foo",Space,Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
diff --git a/tests/lhs-test.fragment.html+lhs b/tests/lhs-test.fragment.html+lhs
--- a/tests/lhs-test.fragment.html+lhs
+++ b/tests/lhs-test.fragment.html+lhs
@@ -5,28 +5,28 @@
   ><code
     >unsplit</code
     > is an arrow that takes a pair of values and combines them to return a single value:</p
-  ><pre class="sourceCode literatehaskell"
+  ><pre class="sourceCode haskell"
   ><code
-    ><span class="Char Special"
-      >&gt;</span
+    ><span class="Special"
+      >&gt; </span
       ><span class="Function FunctionDefinition"
-      > unsplit ::</span
+      >unsplit ::</span
       ><span class="Normal NormalText"
       > (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span
       ><br
-       /><span class="Char Special"
-      >&gt;</span
+       /><span class="Special"
+      >&gt; </span
       ><span class="Normal NormalText"
-      > unsplit = arr . </span
+      >unsplit = arr . </span
       ><span class="Function"
       >uncurry</span
       ><span class="Normal NormalText"
       >       </span
       ><br
-       /><span class="Char Special"
-      >&gt;</span
+       /><span class="Special"
+      >&gt; </span
       ><span class="Normal NormalText"
-      >           </span
+      >          </span
       ><span class="Comment"
       >-- arr (\op (x,y) -&gt; x `op` y) </span
       ><br
diff --git a/tests/lhs-test.html+lhs b/tests/lhs-test.html+lhs
--- a/tests/lhs-test.html+lhs
+++ b/tests/lhs-test.html+lhs
@@ -36,28 +36,28 @@
       ><code
 	>unsplit</code
 	> is an arrow that takes a pair of values and combines them to return a single value:</p
-      ><pre class="sourceCode literatehaskell"
+      ><pre class="sourceCode haskell"
       ><code
-	><span class="Char Special"
-	  >&gt;</span
+	><span class="Special"
+	  >&gt; </span
 	  ><span class="Function FunctionDefinition"
-	  > unsplit ::</span
+	  >unsplit ::</span
 	  ><span class="Normal NormalText"
 	  > (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span
 	  ><br
-	   /><span class="Char Special"
-	  >&gt;</span
+	   /><span class="Special"
+	  >&gt; </span
 	  ><span class="Normal NormalText"
-	  > unsplit = arr . </span
+	  >unsplit = arr . </span
 	  ><span class="Function"
 	  >uncurry</span
 	  ><span class="Normal NormalText"
 	  >       </span
 	  ><br
-	   /><span class="Char Special"
-	  >&gt;</span
+	   /><span class="Special"
+	  >&gt; </span
 	  ><span class="Normal NormalText"
-	  >           </span
+	  >          </span
 	  ><span class="Comment"
 	  >-- arr (\op (x,y) -&gt; x `op` y) </span
 	  ><br
diff --git a/tests/lhs-test.native b/tests/lhs-test.native
--- a/tests/lhs-test.native
+++ b/tests/lhs-test.native
@@ -1,7 +1,7 @@
 Pandoc (Meta [] [] "")
 [ Header 1 [Str "lhs",Space,Str "test"]
 , Para [Code "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",Space,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]
-, CodeBlock ("",["sourceCode","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry       \n          -- arr (\\op (x,y) -> x `op` y) "
+, CodeBlock ("",["sourceCode","literate","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry       \n          -- arr (\\op (x,y) -> x `op` y) "
 , Para [Code "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)",Str "."]
 , CodeBlock ("",[],[]) "f *** g = first f >>> second g"
 , Para [Str "Block",Space,Str "quote:"]
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -6,12 +6,20 @@
 , Para [TeX "\\placeformula",Space,TeX "\\startformula\n   L_{1} = L_{2}\n   \\stopformula"]
 , Para [TeX "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"]
 , Header 2 [Str "URLs",Space,Str "with",Space,Str "spaces"]
-, Para [Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("bar%20baz","title")]
-, Para [Link [Str "baz"] ("/foo%20foo",""),Space,Link [Str "bam"] ("/foo%20fee",""),Space,Link [Str "bork"] ("/foo/zee%20zob","title")]
+, Para [Link [Str "foo"] ("/bar+and+baz",""),Space,Link [Str "foo"] ("/bar+and+baz",""),Space,Link [Str "foo"] ("/bar+and+baz",""),Space,Link [Str "foo"] ("bar+baz","title")]
+, Para [Link [Str "baz"] ("/foo+foo",""),Space,Link [Str "bam"] ("/foo+fee",""),Space,Link [Str "bork"] ("/foo/zee+zob","title")]
 , Header 2 [Str "Horizontal",Space,Str "rules",Space,Str "with",Space,Str "spaces",Space,Str "at",Space,Str "end"]
 , HorizontalRule
 , HorizontalRule
 , Header 2 [Str "Raw",Space,Str "HTML",Space,Str "before",Space,Str "header"]
 , Plain [HtmlInline "<a>",HtmlInline "</a>"]
-, Header 3 [Str "my",Space,Str "header"] ]
+, Header 3 [Str "my",Space,Str "header"]
+, Header 2 [Str "$",Space,Str "in",Space,Str "math"]
+, Para [Math InlineMath "\\$2 + \\$3"]
+, Header 2 [Str "Commented",Str "-",Str "out",Space,Str "list",Space,Str "item"]
+, BulletList
+  [ [ Plain [Str "one"]
+    , RawHtml "<!--\n- two\n-->" ], [ Plain [Str "three"] ] ]
+, Header 2 [Str "Backslash",Space,Str "newline"]
+, Para [Str "hi",LineBreak,Str "there"] ]
 
diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt
--- a/tests/markdown-reader-more.txt
+++ b/tests/markdown-reader-more.txt
@@ -47,3 +47,20 @@
 
 ### my header
 
+## $ in math
+
+$\$2 + \$3$
+
+## Commented-out list item
+
+- one
+<!--
+- two
+-->
+- three
+
+## Backslash newline
+
+hi\
+there
+
diff --git a/tests/rst-reader.native b/tests/rst-reader.native
--- a/tests/rst-reader.native
+++ b/tests/rst-reader.native
@@ -1,8 +1,8 @@
 Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":",Space,Str "Subtitle"] ["John MacFarlane","Anonymous"] "July 17, 2006")
 [ DefinitionList
-  [  ([Str "Revision"],
-     [ Plain [Str "3"] ]
-    ) ]
+  [ ([Str "Revision"],
+     [ [ Plain [Str "3"] ]
+     ]) ]
 , Header 1 [Str "Level",Space,Str "one",Space,Str "header"]
 , Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
 , Header 2 [Str "Level",Space,Str "two",Space,Str "header"]
@@ -43,6 +43,8 @@
 , CodeBlock ("",[],[]) "this code block is indented by one tab"
 , Para [Str "And",Str ":"]
 , CodeBlock ("",[],[]) "this block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
+, Para [Str "And",Str ":"]
+, CodeBlock ("",["sourceCode","python"],[]) "def my_function(x):\n    return x + 1"
 , Header 1 [Str "Lists"]
 , Header 2 [Str "Unordered"]
 , Para [Str "Asterisks",Space,Str "tight",Str ":"]
@@ -152,36 +154,36 @@
   , [ Plain [Str "item",Space,Str "2"] ] ]
 , Header 2 [Str "Definition"]
 , DefinitionList
-  [  ([Str "term",Space,Str "1"],
-     [ Para [Str "Definition",Space,Str "1."] ]
-    ),
-    ([Str "term",Space,Str "2"],
-     [ Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "1."]
-     , Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "2."] ]  ),
-    ([Str "term",Space,Str "with",Space,Emph [Str "emphasis"]],
-     [ Para [Str "Definition",Space,Str "3."] ]
-    ) ]
+  [ ([Str "term",Space,Str "1"],
+     [ [ Para [Str "Definition",Space,Str "1."] ]
+     ])
+  , ([Str "term",Space,Str "2"],
+     [ [ Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "1."]
+       , Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "2."] ]])
+  , ([Str "term",Space,Str "with",Space,Emph [Str "emphasis"]],
+     [ [ Para [Str "Definition",Space,Str "3."] ]
+     ]) ]
 , Header 1 [Str "Field",Space,Str "Lists"]
 , DefinitionList
-  [  ([Str "address"],
-     [ Plain [Str "61",Space,Str "Main",Space,Str "St."] ]
-    ),
-    ([Str "city"],
-     [ Plain [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"] ]
-    ),
-    ([Str "phone"],
-     [ Plain [Str "123",Str "-",Str "4567"] ]
-    ) ]
+  [ ([Str "address"],
+     [ [ Plain [Str "61",Space,Str "Main",Space,Str "St."] ]
+     ])
+  , ([Str "city"],
+     [ [ Plain [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"] ]
+     ])
+  , ([Str "phone"],
+     [ [ Plain [Str "123",Str "-",Str "4567"] ]
+     ]) ]
 , DefinitionList
-  [  ([Str "address"],
-     [ Plain [Str "61",Space,Str "Main",Space,Str "St."] ]
-    ),
-    ([Str "city"],
-     [ Plain [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"] ]
-    ),
-    ([Str "phone"],
-     [ Plain [Str "123",Str "-",Str "4567"] ]
-    ) ]
+  [ ([Str "address"],
+     [ [ Plain [Str "61",Space,Str "Main",Space,Str "St."] ]
+     ])
+  , ([Str "city"],
+     [ [ Plain [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"] ]
+     ])
+  , ([Str "phone"],
+     [ [ Plain [Str "123",Str "-",Str "4567"] ]
+     ]) ]
 , Header 1 [Str "HTML",Space,Str "Blocks"]
 , Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line",Str ":"]
 , RawHtml "<div>foo</div>\n"
diff --git a/tests/rst-reader.rst b/tests/rst-reader.rst
--- a/tests/rst-reader.rst
+++ b/tests/rst-reader.rst
@@ -101,6 +101,13 @@
 
         These should not be escaped:  \$ \\ \> \[ \{
 
+And:
+
+.. code-block:: python
+
+   def my_function(x):
+       return x + 1
+
 Lists
 =====
 
diff --git a/tests/tables.context b/tests/tables.context
--- a/tests/tables.context
+++ b/tests/tables.context
@@ -1,7 +1,7 @@
 Simple table with caption:
 
 \placetable[here]{Demonstration of simple table syntax.}
-\starttable[|rp(0.15\textwidth)|lp(0.09\textwidth)|cp(0.16\textwidth)|lp(0.13\textwidth)|]
+\starttable[|r|l|c|l|]
 \HL
 \NC Right
 \NC Left
@@ -30,7 +30,7 @@
 Simple table without caption:
 
 \placetable[here]{none}
-\starttable[|rp(0.15\textwidth)|lp(0.09\textwidth)|cp(0.16\textwidth)|lp(0.13\textwidth)|]
+\starttable[|r|l|c|l|]
 \HL
 \NC Right
 \NC Left
@@ -59,7 +59,7 @@
 Simple table indented two spaces:
 
 \placetable[here]{Demonstration of simple table syntax.}
-\starttable[|rp(0.15\textwidth)|lp(0.09\textwidth)|cp(0.16\textwidth)|lp(0.13\textwidth)|]
+\starttable[|r|l|c|l|]
 \HL
 \NC Right
 \NC Left
diff --git a/tests/tables.docbook b/tests/tables.docbook
--- a/tests/tables.docbook
+++ b/tests/tables.docbook
@@ -6,16 +6,16 @@
     Demonstration of simple table syntax.
   </caption>
   <tr>
-    <th align="right" style="{width: 15%;}">
+    <th align="right">
       Right
     </th>
-    <th align="left" style="{width: 8%;}">
+    <th align="left">
       Left
     </th>
-    <th align="center" style="{width: 16%;}">
+    <th align="center">
       Center
     </th>
-    <th align="left" style="{width: 12%;}">
+    <th align="left">
       Default
     </th>
   </tr>
@@ -67,16 +67,16 @@
 </para>
 <informaltable>
   <tr>
-    <th align="right" style="{width: 15%;}">
+    <th align="right">
       Right
     </th>
-    <th align="left" style="{width: 8%;}">
+    <th align="left">
       Left
     </th>
-    <th align="center" style="{width: 16%;}">
+    <th align="center">
       Center
     </th>
-    <th align="left" style="{width: 12%;}">
+    <th align="left">
       Default
     </th>
   </tr>
@@ -131,16 +131,16 @@
     Demonstration of simple table syntax.
   </caption>
   <tr>
-    <th align="right" style="{width: 15%;}">
+    <th align="right">
       Right
     </th>
-    <th align="left" style="{width: 8%;}">
+    <th align="left">
       Left
     </th>
-    <th align="center" style="{width: 16%;}">
+    <th align="center">
       Center
     </th>
-    <th align="left" style="{width: 12%;}">
+    <th align="left">
       Default
     </th>
   </tr>
diff --git a/tests/tables.html b/tests/tables.html
--- a/tests/tables.html
+++ b/tests/tables.html
@@ -4,13 +4,13 @@
 ><caption
   >Demonstration of simple table syntax.</caption
   ><tr class="header"
-  ><th align="right" style="width: 15%;"
+  ><th align="right"
     >Right</th
-    ><th align="left" style="width: 8%;"
+    ><th align="left"
     >Left</th
-    ><th align="center" style="width: 16%;"
+    ><th align="center"
     >Center</th
-    ><th align="left" style="width: 12%;"
+    ><th align="left"
     >Default</th
     ></tr
   ><tr class="odd"
@@ -48,13 +48,13 @@
 >Simple table without caption:</p
 ><table
 ><tr class="header"
-  ><th align="right" style="width: 15%;"
+  ><th align="right"
     >Right</th
-    ><th align="left" style="width: 8%;"
+    ><th align="left"
     >Left</th
-    ><th align="center" style="width: 16%;"
+    ><th align="center"
     >Center</th
-    ><th align="left" style="width: 12%;"
+    ><th align="left"
     >Default</th
     ></tr
   ><tr class="odd"
@@ -94,13 +94,13 @@
 ><caption
   >Demonstration of simple table syntax.</caption
   ><tr class="header"
-  ><th align="right" style="width: 15%;"
+  ><th align="right"
     >Right</th
-    ><th align="left" style="width: 8%;"
+    ><th align="left"
     >Left</th
-    ><th align="center" style="width: 16%;"
+    ><th align="center"
     >Center</th
-    ><th align="left" style="width: 12%;"
+    ><th align="left"
     >Default</th
     ></tr
   ><tr class="odd"
diff --git a/tests/tables.latex b/tests/tables.latex
--- a/tests/tables.latex
+++ b/tests/tables.latex
@@ -2,7 +2,7 @@
 
 \begin{table}[h]
 \begin{center}
-\begin{tabular}{>{\PBS\raggedleft\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.09\columnwidth}>{\PBS\centering\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.13\columnwidth}}
+\begin{tabular}{rlcl}
 Right
  & Left
  & Center
@@ -32,7 +32,7 @@
 Simple table without caption:
 
 \begin{center}
-\begin{tabular}{>{\PBS\raggedleft\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.09\columnwidth}>{\PBS\centering\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.13\columnwidth}}
+\begin{tabular}{rlcl}
 Right
  & Left
  & Center
@@ -61,7 +61,7 @@
 
 \begin{table}[h]
 \begin{center}
-\begin{tabular}{>{\PBS\raggedleft\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.09\columnwidth}>{\PBS\centering\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.13\columnwidth}}
+\begin{tabular}{rlcl}
 Right
  & Left
  & Center
diff --git a/tests/tables.man b/tests/tables.man
--- a/tests/tables.man
+++ b/tests/tables.man
@@ -4,7 +4,7 @@
 Demonstration of simple table syntax.
 .TS
 tab(@);
-rw(10.50n) lw(6.13n) cw(11.38n) lw(8.75n).
+r l c l.
 T{
 Right
 T}@T{
@@ -48,7 +48,7 @@
 .PP
 .TS
 tab(@);
-rw(10.50n) lw(6.13n) cw(11.38n) lw(8.75n).
+r l c l.
 T{
 Right
 T}@T{
@@ -93,7 +93,7 @@
 Demonstration of simple table syntax.
 .TS
 tab(@);
-rw(10.50n) lw(6.13n) cw(11.38n) lw(8.75n).
+r l c l.
 T{
 Right
 T}@T{
diff --git a/tests/tables.markdown b/tests/tables.markdown
--- a/tests/tables.markdown
+++ b/tests/tables.markdown
@@ -1,28 +1,28 @@
 Simple table with caption:
 
-        Right Left      Center    Default
-  ----------- ------ ------------ ---------
-           12 12          12      12
-          123 123        123      123
-            1 1           1       1
+    Right Left    Center  Default
+  ------- ------ -------- ---------
+       12 12        12    12
+      123 123      123    123
+        1 1         1     1
   
   Table: Demonstration of simple table syntax.
 
 Simple table without caption:
 
-        Right Left      Center    Default
-  ----------- ------ ------------ ---------
-           12 12          12      12
-          123 123        123      123
-            1 1           1       1
+    Right Left    Center  Default
+  ------- ------ -------- ---------
+       12 12        12    12
+      123 123      123    123
+        1 1         1     1
 
 Simple table indented two spaces:
 
-        Right Left      Center    Default
-  ----------- ------ ------------ ---------
-           12 12          12      12
-          123 123        123      123
-            1 1           1       1
+    Right Left    Center  Default
+  ------- ------ -------- ---------
+       12 12        12    12
+      123 123      123    123
+        1 1         1     1
   
   Table: Demonstration of simple table syntax.
 
diff --git a/tests/tables.mediawiki b/tests/tables.mediawiki
--- a/tests/tables.mediawiki
+++ b/tests/tables.mediawiki
@@ -2,10 +2,10 @@
 
 <table>
 <caption>Demonstration of simple table syntax.</caption><tr>
-<th align="right" style="width: 15%;">Right</th>
-<th align="left" style="width: 8%;">Left</th>
-<th align="center" style="width: 16%;">Center</th>
-<th align="left" style="width: 12%;">Default</th>
+<th align="right">Right</th>
+<th align="left">Left</th>
+<th align="center">Center</th>
+<th align="left">Default</th>
 </tr><tr>
 <td align="right">12</td>
 <td align="left">12</td>
@@ -29,10 +29,10 @@
 
 <table>
 <tr>
-<th align="right" style="width: 15%;">Right</th>
-<th align="left" style="width: 8%;">Left</th>
-<th align="center" style="width: 16%;">Center</th>
-<th align="left" style="width: 12%;">Default</th>
+<th align="right">Right</th>
+<th align="left">Left</th>
+<th align="center">Center</th>
+<th align="left">Default</th>
 </tr><tr>
 <td align="right">12</td>
 <td align="left">12</td>
@@ -56,10 +56,10 @@
 
 <table>
 <caption>Demonstration of simple table syntax.</caption><tr>
-<th align="right" style="width: 15%;">Right</th>
-<th align="left" style="width: 8%;">Left</th>
-<th align="center" style="width: 16%;">Center</th>
-<th align="left" style="width: 12%;">Default</th>
+<th align="right">Right</th>
+<th align="left">Left</th>
+<th align="center">Center</th>
+<th align="left">Default</th>
 </tr><tr>
 <td align="right">12</td>
 <td align="left">12</td>
diff --git a/tests/tables.native b/tests/tables.native
--- a/tests/tables.native
+++ b/tests/tables.native
@@ -1,6 +1,6 @@
 Pandoc (Meta [] [] "")
 [ Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-, Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.15,8.75e-2,0.1625,0.125]
+, Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
   [ [ Plain [Str "Right"] ]
   , [ Plain [Str "Left"] ]
   , [ Plain [Str "Center"] ]
@@ -18,7 +18,7 @@
   , [ Plain [Str "1"] ]
   , [ Plain [Str "1"] ] ] ]
 , Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-, Table [] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.15,8.75e-2,0.1625,0.125]
+, Table [] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
   [ [ Plain [Str "Right"] ]
   , [ Plain [Str "Left"] ]
   , [ Plain [Str "Center"] ]
@@ -36,7 +36,7 @@
   , [ Plain [Str "1"] ]
   , [ Plain [Str "1"] ] ] ]
 , Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces:"]
-, Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.15,8.75e-2,0.1625,0.125]
+, Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
   [ [ Plain [Str "Right"] ]
   , [ Plain [Str "Left"] ]
   , [ Plain [Str "Center"] ]
diff --git a/tests/tables.opendocument b/tests/tables.opendocument
--- a/tests/tables.opendocument
+++ b/tests/tables.opendocument
@@ -67,91 +67,67 @@
       <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />
     </style:style>
     <style:style style:name="Table1">
-      <style:table-properties style:rel-width="100%" table:align="center" />
-    </style:style>
-    <style:style style:name="Table1.A" style:family="table-column">
-      <style:table-column-properties style:column-width="1.05in" />
-    </style:style>
-    <style:style style:name="Table1.B" style:family="table-column">
-      <style:table-column-properties style:column-width="0.61in" />
-    </style:style>
-    <style:style style:name="Table1.C" style:family="table-column">
-      <style:table-column-properties style:column-width="1.14in" />
-    </style:style>
-    <style:style style:name="Table1.D" style:family="table-column">
-      <style:table-column-properties style:column-width="0.88in" />
+      <style:table-properties table:align="center" />
     </style:style>
+    <style:style style:name="Table1.A" style:family="table-column" />
+    <style:style style:name="Table1.B" style:family="table-column" />
+    <style:style style:name="Table1.C" style:family="table-column" />
+    <style:style style:name="Table1.D" style:family="table-column" />
     <style:style style:name="Table1.A1" style:family="table-cell">
       <style:table-cell-properties fo:border="none" />
     </style:style>
     <style:style style:name="Table2">
-      <style:table-properties style:rel-width="100%" table:align="center" />
-    </style:style>
-    <style:style style:name="Table2.A" style:family="table-column">
-      <style:table-column-properties style:column-width="1.05in" />
-    </style:style>
-    <style:style style:name="Table2.B" style:family="table-column">
-      <style:table-column-properties style:column-width="0.61in" />
-    </style:style>
-    <style:style style:name="Table2.C" style:family="table-column">
-      <style:table-column-properties style:column-width="1.14in" />
-    </style:style>
-    <style:style style:name="Table2.D" style:family="table-column">
-      <style:table-column-properties style:column-width="0.88in" />
+      <style:table-properties table:align="center" />
     </style:style>
+    <style:style style:name="Table2.A" style:family="table-column" />
+    <style:style style:name="Table2.B" style:family="table-column" />
+    <style:style style:name="Table2.C" style:family="table-column" />
+    <style:style style:name="Table2.D" style:family="table-column" />
     <style:style style:name="Table2.A1" style:family="table-cell">
       <style:table-cell-properties fo:border="none" />
     </style:style>
     <style:style style:name="Table3">
-      <style:table-properties style:rel-width="100%" table:align="center" />
-    </style:style>
-    <style:style style:name="Table3.A" style:family="table-column">
-      <style:table-column-properties style:column-width="1.05in" />
-    </style:style>
-    <style:style style:name="Table3.B" style:family="table-column">
-      <style:table-column-properties style:column-width="0.61in" />
-    </style:style>
-    <style:style style:name="Table3.C" style:family="table-column">
-      <style:table-column-properties style:column-width="1.14in" />
-    </style:style>
-    <style:style style:name="Table3.D" style:family="table-column">
-      <style:table-column-properties style:column-width="0.88in" />
+      <style:table-properties table:align="center" />
     </style:style>
+    <style:style style:name="Table3.A" style:family="table-column" />
+    <style:style style:name="Table3.B" style:family="table-column" />
+    <style:style style:name="Table3.C" style:family="table-column" />
+    <style:style style:name="Table3.D" style:family="table-column" />
     <style:style style:name="Table3.A1" style:family="table-cell">
       <style:table-cell-properties fo:border="none" />
     </style:style>
     <style:style style:name="Table4">
-      <style:table-properties style:rel-width="100%" table:align="center" />
+      <style:table-properties table:align="center" />
     </style:style>
     <style:style style:name="Table4.A" style:family="table-column">
-      <style:table-column-properties style:column-width="1.05in" />
+      <style:table-column-properties style:rel-column-width="9830*" />
     </style:style>
     <style:style style:name="Table4.B" style:family="table-column">
-      <style:table-column-properties style:column-width="0.96in" />
+      <style:table-column-properties style:rel-column-width="9011*" />
     </style:style>
     <style:style style:name="Table4.C" style:family="table-column">
-      <style:table-column-properties style:column-width="1.14in" />
+      <style:table-column-properties style:rel-column-width="10649*" />
     </style:style>
     <style:style style:name="Table4.D" style:family="table-column">
-      <style:table-column-properties style:column-width="2.36in" />
+      <style:table-column-properties style:rel-column-width="22118*" />
     </style:style>
     <style:style style:name="Table4.A1" style:family="table-cell">
       <style:table-cell-properties fo:border="none" />
     </style:style>
     <style:style style:name="Table5">
-      <style:table-properties style:rel-width="100%" table:align="center" />
+      <style:table-properties table:align="center" />
     </style:style>
     <style:style style:name="Table5.A" style:family="table-column">
-      <style:table-column-properties style:column-width="1.05in" />
+      <style:table-column-properties style:rel-column-width="9830*" />
     </style:style>
     <style:style style:name="Table5.B" style:family="table-column">
-      <style:table-column-properties style:column-width="0.96in" />
+      <style:table-column-properties style:rel-column-width="9011*" />
     </style:style>
     <style:style style:name="Table5.C" style:family="table-column">
-      <style:table-column-properties style:column-width="1.14in" />
+      <style:table-column-properties style:rel-column-width="10649*" />
     </style:style>
     <style:style style:name="Table5.D" style:family="table-column">
-      <style:table-column-properties style:column-width="2.36in" />
+      <style:table-column-properties style:rel-column-width="22118*" />
     </style:style>
     <style:style style:name="Table5.A1" style:family="table-cell">
       <style:table-cell-properties fo:border="none" />
diff --git a/tests/tables.rst b/tests/tables.rst
--- a/tests/tables.rst
+++ b/tests/tables.rst
@@ -1,40 +1,40 @@
 Simple table with caption:
 
-+-------------+--------+--------------+-----------+
-| Right       | Left   | Center       | Default   |
-+=============+========+==============+===========+
-| 12          | 12     | 12           | 12        |
-+-------------+--------+--------------+-----------+
-| 123         | 123    | 123          | 123       |
-+-------------+--------+--------------+-----------+
-| 1           | 1      | 1            | 1         |
-+-------------+--------+--------------+-----------+
++---------+--------+----------+-----------+
+| Right   | Left   | Center   | Default   |
++=========+========+==========+===========+
+| 12      | 12     | 12       | 12        |
++---------+--------+----------+-----------+
+| 123     | 123    | 123      | 123       |
++---------+--------+----------+-----------+
+| 1       | 1      | 1        | 1         |
++---------+--------+----------+-----------+
 
 Table: Demonstration of simple table syntax.
 
 Simple table without caption:
 
-+-------------+--------+--------------+-----------+
-| Right       | Left   | Center       | Default   |
-+=============+========+==============+===========+
-| 12          | 12     | 12           | 12        |
-+-------------+--------+--------------+-----------+
-| 123         | 123    | 123          | 123       |
-+-------------+--------+--------------+-----------+
-| 1           | 1      | 1            | 1         |
-+-------------+--------+--------------+-----------+
++---------+--------+----------+-----------+
+| Right   | Left   | Center   | Default   |
++=========+========+==========+===========+
+| 12      | 12     | 12       | 12        |
++---------+--------+----------+-----------+
+| 123     | 123    | 123      | 123       |
++---------+--------+----------+-----------+
+| 1       | 1      | 1        | 1         |
++---------+--------+----------+-----------+
 
 Simple table indented two spaces:
 
-+-------------+--------+--------------+-----------+
-| Right       | Left   | Center       | Default   |
-+=============+========+==============+===========+
-| 12          | 12     | 12           | 12        |
-+-------------+--------+--------------+-----------+
-| 123         | 123    | 123          | 123       |
-+-------------+--------+--------------+-----------+
-| 1           | 1      | 1            | 1         |
-+-------------+--------+--------------+-----------+
++---------+--------+----------+-----------+
+| Right   | Left   | Center   | Default   |
++=========+========+==========+===========+
+| 12      | 12     | 12       | 12        |
++---------+--------+----------+-----------+
+| 123     | 123    | 123      | 123       |
++---------+--------+----------+-----------+
+| 1       | 1      | 1        | 1         |
++---------+--------+----------+-----------+
 
 Table: Demonstration of simple table syntax.
 
diff --git a/tests/tables.rtf b/tests/tables.rtf
--- a/tests/tables.rtf
+++ b/tests/tables.rtf
@@ -1,7 +1,7 @@
 {\pard \ql \f0 \sa180 \li0 \fi0 Simple table with caption:\par}
 {
 \trowd \trgaph120
-\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2052\clbrdrb\brdrs\cellx3456\clbrdrb\brdrs\cellx4536
+\clbrdrb\brdrs\cellx2160\clbrdrb\brdrs\cellx4320\clbrdrb\brdrs\cellx6480\clbrdrb\brdrs\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 Right\par}
@@ -16,7 +16,7 @@
 \intbl\row}
 {
 \trowd \trgaph120
-\cellx1296\cellx2052\cellx3456\cellx4536
+\cellx2160\cellx4320\cellx6480\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}
@@ -31,7 +31,7 @@
 \intbl\row}
 {
 \trowd \trgaph120
-\cellx1296\cellx2052\cellx3456\cellx4536
+\cellx2160\cellx4320\cellx6480\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}
@@ -46,7 +46,7 @@
 \intbl\row}
 {
 \trowd \trgaph120
-\cellx1296\cellx2052\cellx3456\cellx4536
+\cellx2160\cellx4320\cellx6480\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}
@@ -63,7 +63,7 @@
 {\pard \ql \f0 \sa180 \li0 \fi0 Simple table without caption:\par}
 {
 \trowd \trgaph120
-\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2052\clbrdrb\brdrs\cellx3456\clbrdrb\brdrs\cellx4536
+\clbrdrb\brdrs\cellx2160\clbrdrb\brdrs\cellx4320\clbrdrb\brdrs\cellx6480\clbrdrb\brdrs\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 Right\par}
@@ -78,7 +78,7 @@
 \intbl\row}
 {
 \trowd \trgaph120
-\cellx1296\cellx2052\cellx3456\cellx4536
+\cellx2160\cellx4320\cellx6480\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}
@@ -93,7 +93,7 @@
 \intbl\row}
 {
 \trowd \trgaph120
-\cellx1296\cellx2052\cellx3456\cellx4536
+\cellx2160\cellx4320\cellx6480\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}
@@ -108,7 +108,7 @@
 \intbl\row}
 {
 \trowd \trgaph120
-\cellx1296\cellx2052\cellx3456\cellx4536
+\cellx2160\cellx4320\cellx6480\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}
@@ -125,7 +125,7 @@
 {\pard \ql \f0 \sa180 \li0 \fi0 Simple table indented two spaces:\par}
 {
 \trowd \trgaph120
-\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2052\clbrdrb\brdrs\cellx3456\clbrdrb\brdrs\cellx4536
+\clbrdrb\brdrs\cellx2160\clbrdrb\brdrs\cellx4320\clbrdrb\brdrs\cellx6480\clbrdrb\brdrs\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 Right\par}
@@ -140,7 +140,7 @@
 \intbl\row}
 {
 \trowd \trgaph120
-\cellx1296\cellx2052\cellx3456\cellx4536
+\cellx2160\cellx4320\cellx6480\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}
@@ -155,7 +155,7 @@
 \intbl\row}
 {
 \trowd \trgaph120
-\cellx1296\cellx2052\cellx3456\cellx4536
+\cellx2160\cellx4320\cellx6480\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}
@@ -170,7 +170,7 @@
 \intbl\row}
 {
 \trowd \trgaph120
-\cellx1296\cellx2052\cellx3456\cellx4536
+\cellx2160\cellx4320\cellx6480\cellx8640
 \trkeep\intbl
 {
 {\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}
diff --git a/tests/tables.texinfo b/tests/tables.texinfo
--- a/tests/tables.texinfo
+++ b/tests/tables.texinfo
@@ -4,7 +4,7 @@
 Simple table with caption:
 
 @float
-@multitable @columnfractions 0.15 0.09 0.16 0.13 
+@multitable {Right} {Left} {Center} {Default} 
 @headitem 
 Right
  @tab Left
@@ -30,7 +30,7 @@
 @end float
 Simple table without caption:
 
-@multitable @columnfractions 0.15 0.09 0.16 0.13 
+@multitable {Right} {Left} {Center} {Default} 
 @headitem 
 Right
  @tab Left
@@ -56,7 +56,7 @@
 Simple table indented two spaces:
 
 @float
-@multitable @columnfractions 0.15 0.09 0.16 0.13 
+@multitable {Right} {Left} {Center} {Default} 
 @headitem 
 Right
  @tab Left
diff --git a/tests/testsuite.native b/tests/testsuite.native
--- a/tests/testsuite.native
+++ b/tests/testsuite.native
@@ -171,48 +171,79 @@
 , Header 1 [Str "Definition",Space,Str "Lists"]
 , Para [Str "Tight",Space,Str "using",Space,Str "spaces:"]
 , DefinitionList
-  [  ([Str "apple"],
-     [ Plain [Str "red",Space,Str "fruit"] ]
-    ),
-    ([Str "orange"],
-     [ Plain [Str "orange",Space,Str "fruit"] ]
-    ),
-    ([Str "banana"],
-     [ Plain [Str "yellow",Space,Str "fruit"] ]
-    ) ]
+  [ ([Str "apple"],
+     [ [ Plain [Str "red",Space,Str "fruit"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Plain [Str "orange",Space,Str "fruit"] ]
+     ])
+  , ([Str "banana"],
+     [ [ Plain [Str "yellow",Space,Str "fruit"] ]
+     ]) ]
 , Para [Str "Tight",Space,Str "using",Space,Str "tabs:"]
 , DefinitionList
-  [  ([Str "apple"],
-     [ Plain [Str "red",Space,Str "fruit"] ]
-    ),
-    ([Str "orange"],
-     [ Plain [Str "orange",Space,Str "fruit"] ]
-    ),
-    ([Str "banana"],
-     [ Plain [Str "yellow",Space,Str "fruit"] ]
-    ) ]
+  [ ([Str "apple"],
+     [ [ Plain [Str "red",Space,Str "fruit"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Plain [Str "orange",Space,Str "fruit"] ]
+     ])
+  , ([Str "banana"],
+     [ [ Plain [Str "yellow",Space,Str "fruit"] ]
+     ]) ]
 , Para [Str "Loose:"]
 , DefinitionList
-  [  ([Str "apple"],
-     [ Para [Str "red",Space,Str "fruit"] ]
-    ),
-    ([Str "orange"],
-     [ Para [Str "orange",Space,Str "fruit"] ]
-    ),
-    ([Str "banana"],
-     [ Para [Str "yellow",Space,Str "fruit"] ]
-    ) ]
+  [ ([Str "apple"],
+     [ [ Para [Str "red",Space,Str "fruit"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Para [Str "orange",Space,Str "fruit"] ]
+     ])
+  , ([Str "banana"],
+     [ [ Para [Str "yellow",Space,Str "fruit"] ]
+     ]) ]
 , Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
 , DefinitionList
-  [  ([Emph [Str "apple"]],
-     [ Para [Str "red",Space,Str "fruit"]
-     , Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"] ]  ),
-    ([Emph [Str "orange"]],
-     [ Para [Str "orange",Space,Str "fruit"]
-     , CodeBlock ("",[],[]) "{ orange code block }"
-     , BlockQuote
-       [ Para [Str "orange",Space,Str "block",Space,Str "quote"] ]
-      ]  ) ]
+  [ ([Emph [Str "apple"]],
+     [ [ Para [Str "red",Space,Str "fruit"]
+       , Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"] ]])
+  , ([Emph [Str "orange"]],
+     [ [ Para [Str "orange",Space,Str "fruit"]
+       , CodeBlock ("",[],[]) "{ orange code block }"
+       , BlockQuote
+         [ Para [Str "orange",Space,Str "block",Space,Str "quote"] ]
+        ]]) ]
+, Para [Str "Multiple",Space,Str "definitions,",Space,Str "tight:"]
+, DefinitionList
+  [ ([Str "apple"],
+     [ [ Plain [Str "red",Space,Str "fruit"] ]
+     , [ Plain [Str "computer"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Plain [Str "orange",Space,Str "fruit"] ]
+     , [ Plain [Str "bank"] ]
+     ]) ]
+, Para [Str "Multiple",Space,Str "definitions,",Space,Str "loose:"]
+, DefinitionList
+  [ ([Str "apple"],
+     [ [ Para [Str "red",Space,Str "fruit"] ]
+     , [ Para [Str "computer"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Para [Str "orange",Space,Str "fruit"] ]
+     , [ Para [Str "bank"] ]
+     ]) ]
+, Para [Str "Blank",Space,Str "line",Space,Str "after",Space,Str "term,",Space,Str "indented",Space,Str "marker,",Space,Str "alternate",Space,Str "markers:"]
+, DefinitionList
+  [ ([Str "apple"],
+     [ [ Para [Str "red",Space,Str "fruit"] ]
+     , [ Para [Str "computer"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Para [Str "orange",Space,Str "fruit"]
+       , OrderedList (1,Decimal,Period)
+         [ [ Plain [Str "sublist"] ]
+         , [ Plain [Str "sublist"] ] ] ]]) ]
 , Header 1 [Str "HTML",Space,Str "Blocks"]
 , Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
 , RawHtml "<div>"
diff --git a/tests/testsuite.txt b/tests/testsuite.txt
--- a/tests/testsuite.txt
+++ b/tests/testsuite.txt
@@ -300,15 +300,51 @@
 *apple*
 :   red fruit
 
-:   contains seeds,
+    contains seeds,
     crisp, pleasant to taste
 
 *orange*
 :   orange fruit
 
-:       { orange code block }
+        { orange code block }
 
-:   > orange block quote
+    > orange block quote
+
+Multiple definitions, tight:
+
+apple
+:   red fruit
+:   computer
+orange
+:   orange fruit
+:   bank
+
+Multiple definitions, loose:
+
+apple
+:   red fruit
+
+:   computer
+
+orange
+:   orange fruit
+
+:   bank
+
+Blank line after term, indented marker, alternate markers:
+
+apple
+
+  ~ red fruit
+
+  ~ computer
+
+orange
+
+  ~ orange fruit
+
+    1. sublist
+    2. sublist
 
 # HTML Blocks
 
diff --git a/tests/writer.context b/tests/writer.context
--- a/tests/writer.context
+++ b/tests/writer.context
@@ -514,6 +514,53 @@
 \stopblockquote
 \stopdescr
 
+Multiple definitions, tight:
+
+\startdescr{apple}
+red fruit
+
+computer
+\stopdescr
+
+\startdescr{orange}
+orange fruit
+
+bank
+\stopdescr
+
+Multiple definitions, loose:
+
+\startdescr{apple}
+red fruit
+
+computer
+\stopdescr
+
+\startdescr{orange}
+orange fruit
+
+bank
+\stopdescr
+
+Blank line after term, indented marker, alternate markers:
+
+\startdescr{apple}
+red fruit
+
+computer
+\stopdescr
+
+\startdescr{orange}
+orange fruit
+
+\startitemize[n][stopper=.]
+\item
+  sublist
+\item
+  sublist
+\stopitemize
+\stopdescr
+
 \subject{HTML Blocks}
 
 Simple block on one line:
diff --git a/tests/writer.docbook b/tests/writer.docbook
--- a/tests/writer.docbook
+++ b/tests/writer.docbook
@@ -19,16 +19,16 @@
     This is a set of tests for pandoc. Most of them are adapted from
     John Gruber's markdown test suite.
   </para>
-  <section>
+  <section id="headers">
     <title>Headers</title>
-    <section>
+    <section id="level-2-with-an-embedded-link">
       <title>Level 2 with an
              <ulink url="/url">embedded link</ulink></title>
-      <section>
+      <section id="level-3-with-emphasis">
         <title>Level 3 with <emphasis>emphasis</emphasis></title>
-        <section>
+        <section id="level-4">
           <title>Level 4</title>
-          <section>
+          <section id="level-5">
             <title>Level 5</title>
             <para>
             </para>
@@ -37,25 +37,25 @@
       </section>
     </section>
   </section>
-  <section>
+  <section id="level-1">
     <title>Level 1</title>
-    <section>
+    <section id="level-2-with-emphasis">
       <title>Level 2 with <emphasis>emphasis</emphasis></title>
-      <section>
+      <section id="level-3">
         <title>Level 3</title>
         <para>
           with no blank line
         </para>
       </section>
     </section>
-    <section>
+    <section id="level-2">
       <title>Level 2</title>
       <para>
         with no blank line
       </para>
     </section>
   </section>
-  <section>
+  <section id="paragraphs">
     <title>Paragraphs</title>
     <para>
       Here's a regular paragraph.
@@ -73,7 +73,7 @@
       break<literallayout></literallayout>here.
     </para>
   </section>
-  <section>
+  <section id="block-quotes">
     <title>Block Quotes</title>
     <para>
       E-mail style:
@@ -128,7 +128,7 @@
       And a following paragraph.
     </para>
   </section>
-  <section>
+  <section id="code-blocks">
     <title>Code Blocks</title>
     <para>
       Code:
@@ -151,9 +151,9 @@
 These should not be escaped:  \$ \\ \&gt; \[ \{
 </screen>
   </section>
-  <section>
+  <section id="lists">
     <title>Lists</title>
-    <section>
+    <section id="unordered">
       <title>Unordered</title>
       <para>
         Asterisks tight:
@@ -276,7 +276,7 @@
         </listitem>
       </itemizedlist>
     </section>
-    <section>
+    <section id="ordered">
       <title>Ordered</title>
       <para>
         Tight:
@@ -383,7 +383,7 @@
         </listitem>
       </orderedlist>
     </section>
-    <section>
+    <section id="nested">
       <title>Nested</title>
       <itemizedlist>
         <listitem>
@@ -481,7 +481,7 @@
         </listitem>
       </orderedlist>
     </section>
-    <section>
+    <section id="tabs-and-spaces">
       <title>Tabs and spaces</title>
       <itemizedlist>
         <listitem>
@@ -508,7 +508,7 @@
         </listitem>
       </itemizedlist>
     </section>
-    <section>
+    <section id="fancy-list-markers">
       <title>Fancy list markers</title>
       <orderedlist numeration="arabic">
         <listitem override="2">
@@ -613,7 +613,7 @@
       </para>
     </section>
   </section>
-  <section>
+  <section id="definition-lists">
     <title>Definition Lists</title>
     <para>
       Tight using spaces:
@@ -756,8 +756,110 @@
         </listitem>
       </varlistentry>
     </variablelist>
+    <para>
+      Multiple definitions, tight:
+    </para>
+    <variablelist>
+      <varlistentry>
+        <term>
+          apple
+        </term>
+        <listitem>
+          <para>
+            red fruit
+          </para>
+          <para>
+            computer
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          orange
+        </term>
+        <listitem>
+          <para>
+            orange fruit
+          </para>
+          <para>
+            bank
+          </para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+    <para>
+      Multiple definitions, loose:
+    </para>
+    <variablelist>
+      <varlistentry>
+        <term>
+          apple
+        </term>
+        <listitem>
+          <para>
+            red fruit
+          </para>
+          <para>
+            computer
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          orange
+        </term>
+        <listitem>
+          <para>
+            orange fruit
+          </para>
+          <para>
+            bank
+          </para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+    <para>
+      Blank line after term, indented marker, alternate markers:
+    </para>
+    <variablelist>
+      <varlistentry>
+        <term>
+          apple
+        </term>
+        <listitem>
+          <para>
+            red fruit
+          </para>
+          <para>
+            computer
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          orange
+        </term>
+        <listitem>
+          <para>
+            orange fruit
+          </para>
+          <orderedlist numeration="arabic">
+            <listitem>
+              <para>
+                sublist
+              </para>
+            </listitem>
+            <listitem>
+              <para>
+                sublist
+              </para>
+            </listitem>
+          </orderedlist>
+        </listitem>
+      </varlistentry>
+    </variablelist>
   </section>
-  <section>
+  <section id="html-blocks">
     <title>HTML Blocks</title>
     <para>
       Simple block on one line:
@@ -886,7 +988,7 @@
 <hr class="foo" id="bar">
 
   </section>
-  <section>
+  <section id="inline-markup">
     <title>Inline Markup</title>
     <para>
       This is <emphasis>emphasized</emphasis>, and so
@@ -936,7 +1038,7 @@
       unescaped spaces: a^b c^d, a~b c~d.
     </para>
   </section>
-  <section>
+  <section id="smart-quotes-ellipses-dashes">
     <title>Smart quotes, ellipses, dashes</title>
     <para>
       <quote>Hello,</quote> said the spider.
@@ -968,7 +1070,7 @@
       Ellipses&#8230;and&#8230;and&#8230;.
     </para>
   </section>
-  <section>
+  <section id="latex">
     <title>LaTeX</title>
     <itemizedlist>
       <listitem>
@@ -1046,7 +1148,7 @@
     <para>
     </para>
   </section>
-  <section>
+  <section id="special-characters">
     <title>Special Characters</title>
     <para>
       Here is some unicode:
@@ -1142,9 +1244,9 @@
       Minus: -
     </para>
   </section>
-  <section>
+  <section id="links">
     <title>Links</title>
-    <section>
+    <section id="explicit">
       <title>Explicit</title>
       <para>
         Just a <ulink url="/url/">URL</ulink>.
@@ -1174,7 +1276,7 @@
         <ulink url="">Empty</ulink>.
       </para>
     </section>
-    <section>
+    <section id="reference">
       <title>Reference</title>
       <para>
         Foo <ulink url="/url/">bar</ulink>.
@@ -1213,7 +1315,7 @@
         Foo <ulink url="/url/">biz</ulink>.
       </para>
     </section>
-    <section>
+    <section id="with-ampersands">
       <title>With ampersands</title>
       <para>
         Here's a
@@ -1231,7 +1333,7 @@
         <ulink url="/script?foo=1&amp;bar=2">inline link in pointy braces</ulink>.
       </para>
     </section>
-    <section>
+    <section id="autolinks">
       <title>Autolinks</title>
       <para>
         With an ampersand:
@@ -1272,7 +1374,7 @@
 </screen>
     </section>
   </section>
-  <section>
+  <section id="images">
     <title>Images</title>
     <para>
       From <quote>Voyage dans la Lune</quote> by Georges Melies (1902):
@@ -1299,7 +1401,7 @@
       icon.
     </para>
   </section>
-  <section>
+  <section id="footnotes">
     <title>Footnotes</title>
     <para>
       Here is a footnote
diff --git a/tests/writer.html b/tests/writer.html
--- a/tests/writer.html
+++ b/tests/writer.html
@@ -540,6 +540,72 @@
 	    ></blockquote
 	  ></dd
 	></dl
+      ><p
+      >Multiple definitions, tight:</p
+      ><dl
+      ><dt
+	>apple</dt
+	><dd
+	>red fruit</dd
+	><dd
+	>computer</dd
+	><dt
+	>orange</dt
+	><dd
+	>orange fruit</dd
+	><dd
+	>bank</dd
+	></dl
+      ><p
+      >Multiple definitions, loose:</p
+      ><dl
+      ><dt
+	>apple</dt
+	><dd
+	><p
+	  >red fruit</p
+	  ></dd
+	><dd
+	><p
+	  >computer</p
+	  ></dd
+	><dt
+	>orange</dt
+	><dd
+	><p
+	  >orange fruit</p
+	  ></dd
+	><dd
+	><p
+	  >bank</p
+	  ></dd
+	></dl
+      ><p
+      >Blank line after term, indented marker, alternate markers:</p
+      ><dl
+      ><dt
+	>apple</dt
+	><dd
+	><p
+	  >red fruit</p
+	  ></dd
+	><dd
+	><p
+	  >computer</p
+	  ></dd
+	><dt
+	>orange</dt
+	><dd
+	><p
+	  >orange fruit</p
+	  ><ol style="list-style-type: decimal;"
+	  ><li
+	    >sublist</li
+	    ><li
+	    >sublist</li
+	    ></ol
+	  ></dd
+	></dl
       ></div
     ><div id="html-blocks"
     ><h1
diff --git a/tests/writer.latex b/tests/writer.latex
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -456,6 +456,53 @@
 
 \end{quote}
 \end{description}
+Multiple definitions, tight:
+
+\begin{description}
+\item[apple]
+red fruit
+
+computer
+\item[orange]
+orange fruit
+
+bank
+\end{description}
+Multiple definitions, loose:
+
+\begin{description}
+\item[apple]
+red fruit
+
+
+computer
+
+\item[orange]
+orange fruit
+
+
+bank
+
+\end{description}
+Blank line after term, indented marker, alternate markers:
+
+\begin{description}
+\item[apple]
+red fruit
+
+
+computer
+
+\item[orange]
+orange fruit
+
+\begin{enumerate}[1.]
+\item
+  sublist
+\item
+  sublist
+\end{enumerate}
+\end{description}
 \section{HTML Blocks}
 
 Simple block on one line:
diff --git a/tests/writer.man b/tests/writer.man
--- a/tests/writer.man
+++ b/tests/writer.man
@@ -381,48 +381,76 @@
 orange block quote
 .RE
 .RE
+.PP
+Multiple definitions, tight:
+.TP
+.B apple
+red fruit
+.RS
+.RE
+computer
+.RS
+.RE
+.TP
+.B orange
+orange fruit
+.RS
+.RE
+bank
+.RS
+.RE
+.PP
+Multiple definitions, loose:
+.TP
+.B apple
+red fruit
+.RS
+.RE
+computer
+.RS
+.RE
+.TP
+.B orange
+orange fruit
+.RS
+.RE
+bank
+.RS
+.RE
+.PP
+Blank line after term, indented marker, alternate markers:
+.TP
+.B apple
+red fruit
+.RS
+.RE
+computer
+.RS
+.RE
+.TP
+.B orange
+orange fruit
+.RS
+.IP "1." 3
+sublist
+.IP "2." 3
+sublist
+.RE
 .SH HTML Blocks
 .PP
 Simple block on one line:
-<div>
 foo
-</div>
-
 .PP
 And nested without indentation:
-<div>
-<div>
-<div>
 foo
-</div>
-</div>
-<div>
 bar
-</div>
-</div>
-
 .PP
 Interpreted markdown in a table:
-<table>
-<tr>
-<td>
 This is \f[I]emphasized\f[]
-</td>
-<td>
 And this is \f[B]strong\f[]
-</td>
-</tr>
-</table>
-
-<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
-
 .PP
 Here's a simple block:
-<div>
-    
 foo
-</div>
-
 .PP
 This should be a code block, though:
 .PP
@@ -439,30 +467,11 @@
 \f[]
 .PP
 Now, nested:
-<div>
-    <div>
-        <div>
-            
 foo
-</div>
-    </div>
-</div>
-
 .PP
 This should just be an HTML comment:
-<!-- Comment -->
-
 .PP
 Multiline:
-<!--
-Blah
-Blah
--->
-
-<!--
-    This is another comment.
--->
-
 .PP
 Code block:
 .PP
@@ -471,8 +480,6 @@
 \f[]
 .PP
 Just plain comment, with trailing spaces on the line:
-<!-- foo -->   
-
 .PP
 Code:
 .PP
@@ -481,24 +488,6 @@
 \f[]
 .PP
 Hr's:
-<hr>
-
-<hr />
-
-<hr />
-
-<hr>   
-
-<hr />  
-
-<hr /> 
-
-<hr class="foo" id="bar" />
-
-<hr class="foo" id="bar" />
-
-<hr class="foo" id="bar">
-
 .PP
    *   *   *   *   *
 .SH Inline Markup
diff --git a/tests/writer.markdown b/tests/writer.markdown
--- a/tests/writer.markdown
+++ b/tests/writer.markdown
@@ -313,14 +313,50 @@
 *apple*
 :   red fruit
 
-:   contains seeds, crisp, pleasant to taste
+    contains seeds, crisp, pleasant to taste
 
 *orange*
 :   orange fruit
 
-:       { orange code block }
+        { orange code block }
 
-:   > orange block quote
+    > orange block quote
+
+
+Multiple definitions, tight:
+
+apple
+:   red fruit
+:   computer
+orange
+:   orange fruit
+:   bank
+
+Multiple definitions, loose:
+
+apple
+:   red fruit
+
+:   computer
+
+orange
+:   orange fruit
+
+:   bank
+
+
+Blank line after term, indented marker, alternate markers:
+
+apple
+:   red fruit
+
+:   computer
+
+orange
+:   orange fruit
+
+    1.  sublist
+    2.  sublist
 
 
 # HTML Blocks
diff --git a/tests/writer.mediawiki b/tests/writer.mediawiki
--- a/tests/writer.mediawiki
+++ b/tests/writer.mediawiki
@@ -57,6 +57,7 @@
 
 # item one
 # item two
+
 Nested block quotes:
 
 <blockquote>nested
@@ -98,31 +99,37 @@
 * asterisk 1
 * asterisk 2
 * asterisk 3
+
 Asterisks loose:
 
 * asterisk 1
 * asterisk 2
 * asterisk 3
+
 Pluses tight:
 
 * Plus 1
 * Plus 2
 * Plus 3
+
 Pluses loose:
 
 * Plus 1
 * Plus 2
 * Plus 3
+
 Minuses tight:
 
 * Minus 1
 * Minus 2
 * Minus 3
+
 Minuses loose:
 
 * Minus 1
 * Minus 2
 * Minus 3
+
 === Ordered ===
 
 Tight:
@@ -130,21 +137,25 @@
 # First
 # Second
 # Third
+
 and:
 
 # One
 # Two
 # Three
+
 Loose using tabs:
 
 # First
 # Second
 # Third
+
 and using spaces:
 
 # One
 # Two
 # Three
+
 Multiple paragraphs:
 
 <ol style="list-style-type: decimal;">
@@ -158,6 +169,9 @@
 * Tab
 ** Tab
 *** Tab
+
+
+
 Here&rsquo;s another:
 
 # First
@@ -165,7 +179,9 @@
 #* Fee
 #* Fie
 #* Foe
+
 # Third
+
 Same thing but with paragraphs:
 
 # First
@@ -173,13 +189,17 @@
 #* Fee
 #* Fie
 #* Foe
+
 # Third
+
 === Tabs and spaces ===
 
 * this is a list item indented with tabs
 * this is a list item indented with spaces
 ** this is an example list item indented with tabs
 ** this is an example list item indented with spaces
+
+
 === Fancy list markers ===
 
 <ol start="2" style="list-style-type: decimal;">
@@ -214,6 +234,8 @@
 # Autonumber.
 # More.
 ## Nested.
+
+
 Should not be a list item:
 
 M.A.&#160;2007
@@ -233,6 +255,7 @@
 : orange fruit
 ; banana
 : yellow fruit
+
 Tight using tabs:
 
 ; apple
@@ -241,6 +264,7 @@
 : orange fruit
 ; banana
 : yellow fruit
+
 Loose:
 
 ; apple
@@ -249,6 +273,7 @@
 : orange fruit
 ; banana
 : yellow fruit
+
 Multiple blocks with italics:
 
 <dl>
@@ -260,6 +285,35 @@
 <pre>{ orange code block }</pre>
 <blockquote><p>orange block quote</p></blockquote></dd></dl>
 
+Multiple definitions, tight:
+
+; apple
+: red fruit
+: computer
+; orange
+: orange fruit
+: bank
+
+Multiple definitions, loose:
+
+; apple
+: red fruit
+: computer
+; orange
+: orange fruit
+: bank
+
+Blank line after term, indented marker, alternate markers:
+
+; apple
+: red fruit
+: computer
+; orange
+: orange fruit
+;# sublist
+;# sublist
+
+
 == HTML Blocks ==
 
 Simple block on one line:
@@ -430,12 +484,14 @@
 * <math>p</math>-Tree
 * Here&rsquo;s some display math: <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math>
 * Here&rsquo;s one that has a line break in it: <math>\alpha + \omega \times x^2</math>.
+
 These shouldn&rsquo;t be math:
 
 * To get the famous equation, write <tt>$e = mc^2$</tt>.
 * $22,000 is a ''lot'' of money. So is $34,000. (It worked if &ldquo;lot&rdquo; is emphasized.)
 * Shoes ($20) and socks ($5).
 * Escaped <tt>$</tt>: $73 ''this should be emphasized'' 23$.
+
 Here&rsquo;s a LaTeX table:
 
 
@@ -452,6 +508,7 @@
 * section: §
 * set membership: ∈
 * copyright: ©
+
 AT&amp;T has an ampersand in their name.
 
 AT&amp;T is another way to write it.
@@ -561,6 +618,7 @@
 * In a list?
 * http://example.com/
 * It should.
+
 An e-mail address: [mailto:nobody@nowhere.net <tt>nobody@nowhere.net</tt>]
 
 <blockquote>Blockquoted: http://example.com/
@@ -598,6 +656,7 @@
 </ref>
 </blockquote>
 # And in list items.<ref>In list.</ref>
+
 This paragraph should not be part of the note, as it is not indented.
 
 == Notes ==
diff --git a/tests/writer.native b/tests/writer.native
--- a/tests/writer.native
+++ b/tests/writer.native
@@ -171,48 +171,79 @@
 , Header 1 [Str "Definition",Space,Str "Lists"]
 , Para [Str "Tight",Space,Str "using",Space,Str "spaces:"]
 , DefinitionList
-  [  ([Str "apple"],
-     [ Plain [Str "red",Space,Str "fruit"] ]
-    ),
-    ([Str "orange"],
-     [ Plain [Str "orange",Space,Str "fruit"] ]
-    ),
-    ([Str "banana"],
-     [ Plain [Str "yellow",Space,Str "fruit"] ]
-    ) ]
+  [ ([Str "apple"],
+     [ [ Plain [Str "red",Space,Str "fruit"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Plain [Str "orange",Space,Str "fruit"] ]
+     ])
+  , ([Str "banana"],
+     [ [ Plain [Str "yellow",Space,Str "fruit"] ]
+     ]) ]
 , Para [Str "Tight",Space,Str "using",Space,Str "tabs:"]
 , DefinitionList
-  [  ([Str "apple"],
-     [ Plain [Str "red",Space,Str "fruit"] ]
-    ),
-    ([Str "orange"],
-     [ Plain [Str "orange",Space,Str "fruit"] ]
-    ),
-    ([Str "banana"],
-     [ Plain [Str "yellow",Space,Str "fruit"] ]
-    ) ]
+  [ ([Str "apple"],
+     [ [ Plain [Str "red",Space,Str "fruit"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Plain [Str "orange",Space,Str "fruit"] ]
+     ])
+  , ([Str "banana"],
+     [ [ Plain [Str "yellow",Space,Str "fruit"] ]
+     ]) ]
 , Para [Str "Loose:"]
 , DefinitionList
-  [  ([Str "apple"],
-     [ Para [Str "red",Space,Str "fruit"] ]
-    ),
-    ([Str "orange"],
-     [ Para [Str "orange",Space,Str "fruit"] ]
-    ),
-    ([Str "banana"],
-     [ Para [Str "yellow",Space,Str "fruit"] ]
-    ) ]
+  [ ([Str "apple"],
+     [ [ Para [Str "red",Space,Str "fruit"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Para [Str "orange",Space,Str "fruit"] ]
+     ])
+  , ([Str "banana"],
+     [ [ Para [Str "yellow",Space,Str "fruit"] ]
+     ]) ]
 , Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
 , DefinitionList
-  [  ([Emph [Str "apple"]],
-     [ Para [Str "red",Space,Str "fruit"]
-     , Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"] ]  ),
-    ([Emph [Str "orange"]],
-     [ Para [Str "orange",Space,Str "fruit"]
-     , CodeBlock ("",[],[]) "{ orange code block }"
-     , BlockQuote
-       [ Para [Str "orange",Space,Str "block",Space,Str "quote"] ]
-      ]  ) ]
+  [ ([Emph [Str "apple"]],
+     [ [ Para [Str "red",Space,Str "fruit"]
+       , Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"] ]])
+  , ([Emph [Str "orange"]],
+     [ [ Para [Str "orange",Space,Str "fruit"]
+       , CodeBlock ("",[],[]) "{ orange code block }"
+       , BlockQuote
+         [ Para [Str "orange",Space,Str "block",Space,Str "quote"] ]
+        ]]) ]
+, Para [Str "Multiple",Space,Str "definitions,",Space,Str "tight:"]
+, DefinitionList
+  [ ([Str "apple"],
+     [ [ Plain [Str "red",Space,Str "fruit"] ]
+     , [ Plain [Str "computer"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Plain [Str "orange",Space,Str "fruit"] ]
+     , [ Plain [Str "bank"] ]
+     ]) ]
+, Para [Str "Multiple",Space,Str "definitions,",Space,Str "loose:"]
+, DefinitionList
+  [ ([Str "apple"],
+     [ [ Para [Str "red",Space,Str "fruit"] ]
+     , [ Para [Str "computer"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Para [Str "orange",Space,Str "fruit"] ]
+     , [ Para [Str "bank"] ]
+     ]) ]
+, Para [Str "Blank",Space,Str "line",Space,Str "after",Space,Str "term,",Space,Str "indented",Space,Str "marker,",Space,Str "alternate",Space,Str "markers:"]
+, DefinitionList
+  [ ([Str "apple"],
+     [ [ Para [Str "red",Space,Str "fruit"] ]
+     , [ Para [Str "computer"] ]
+     ])
+  , ([Str "orange"],
+     [ [ Para [Str "orange",Space,Str "fruit"]
+       , OrderedList (1,Decimal,Period)
+         [ [ Plain [Str "sublist"] ]
+         , [ Plain [Str "sublist"] ] ] ]]) ]
 , Header 1 [Str "HTML",Space,Str "Blocks"]
 , Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
 , RawHtml "<div>"
diff --git a/tests/writer.opendocument b/tests/writer.opendocument
--- a/tests/writer.opendocument
+++ b/tests/writer.opendocument
@@ -498,6 +498,11 @@
       </text:list-level-style-number>
     </text:list-style>
     <text:list-style style:name="L25">
+      <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">
+        <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />
+      </text:list-level-style-number>
+    </text:list-style>
+    <text:list-style style:name="L26">
       <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">
         <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />
       </text:list-level-style-bullet>
@@ -529,7 +534,7 @@
         <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />
       </text:list-level-style-bullet>
     </text:list-style>
-    <text:list-style style:name="L26">
+    <text:list-style style:name="L27">
       <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">
         <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />
       </text:list-level-style-bullet>
@@ -561,7 +566,7 @@
         <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />
       </text:list-level-style-bullet>
     </text:list-style>
-    <text:list-style style:name="L27">
+    <text:list-style style:name="L28">
       <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">
         <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />
       </text:list-level-style-bullet>
@@ -593,7 +598,7 @@
         <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />
       </text:list-level-style-bullet>
     </text:list-style>
-    <text:list-style style:name="L28">
+    <text:list-style style:name="L29">
       <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">
         <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />
       </text:list-level-style-bullet>
@@ -625,7 +630,7 @@
         <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />
       </text:list-level-style-bullet>
     </text:list-style>
-    <text:list-style style:name="L29">
+    <text:list-style style:name="L30">
       <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">
         <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />
       </text:list-level-style-number>
@@ -825,7 +830,8 @@
     <style:style style:name="P43" style:family="paragraph" style:parent-style-name="Quotations">
       <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />
     </style:style>
-    <style:style style:name="P44" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
+    <style:style style:name="P44" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L25">
+      <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />
     </style:style>
     <style:style style:name="P45" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
     </style:style>
@@ -837,8 +843,7 @@
     </style:style>
     <style:style style:name="P49" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
     </style:style>
-    <style:style style:name="P50" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L25">
-      <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />
+    <style:style style:name="P50" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
     </style:style>
     <style:style style:name="P51" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L26">
       <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />
@@ -846,22 +851,25 @@
     <style:style style:name="P52" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L27">
       <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />
     </style:style>
-    <style:style style:name="P53" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
+    <style:style style:name="P53" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L28">
+      <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />
     </style:style>
-    <style:style style:name="P54" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L28">
+    <style:style style:name="P54" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
+    </style:style>
+    <style:style style:name="P55" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L29">
       <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />
     </style:style>
-    <style:style style:name="P55" style:family="paragraph" style:parent-style-name="Quotations">
+    <style:style style:name="P56" style:family="paragraph" style:parent-style-name="Quotations">
       <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />
     </style:style>
-    <style:style style:name="P56" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
-    </style:style>
     <style:style style:name="P57" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
     </style:style>
-    <style:style style:name="P58" style:family="paragraph" style:parent-style-name="Quotations">
+    <style:style style:name="P58" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
+    </style:style>
+    <style:style style:name="P59" style:family="paragraph" style:parent-style-name="Quotations">
       <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />
     </style:style>
-    <style:style style:name="P59" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L29">
+    <style:style style:name="P60" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L30">
       <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />
     </style:style>
   </office:automatic-styles>
@@ -1269,6 +1277,37 @@
       <text:p text:style-name="Definition_20_Definition">orange fruit</text:p>
       <text:p text:style-name="P42">{ orange code block }</text:p>
       <text:p text:style-name="P43">orange block quote</text:p>
+      <text:p text:style-name="Text_20_body">Multiple definitions,
+                                             tight:</text:p>
+      <text:p text:style-name="Definition_20_Term_20_Tight">apple</text:p>
+      <text:p text:style-name="Definition_20_Definition_20_Tight">red fruit</text:p>
+      <text:p text:style-name="Definition_20_Definition_20_Tight">computer</text:p>
+      <text:p text:style-name="Definition_20_Term_20_Tight">orange</text:p>
+      <text:p text:style-name="Definition_20_Definition_20_Tight">orange fruit</text:p>
+      <text:p text:style-name="Definition_20_Definition_20_Tight">bank</text:p>
+      <text:p text:style-name="Text_20_body">Multiple definitions,
+                                             loose:</text:p>
+      <text:p text:style-name="Definition_20_Term">apple</text:p>
+      <text:p text:style-name="Definition_20_Definition">red fruit</text:p>
+      <text:p text:style-name="Definition_20_Definition">computer</text:p>
+      <text:p text:style-name="Definition_20_Term">orange</text:p>
+      <text:p text:style-name="Definition_20_Definition">orange fruit</text:p>
+      <text:p text:style-name="Definition_20_Definition">bank</text:p>
+      <text:p text:style-name="Text_20_body">Blank line after term,
+                                             indented marker, alternate markers:</text:p>
+      <text:p text:style-name="Definition_20_Term">apple</text:p>
+      <text:p text:style-name="Definition_20_Definition">red fruit</text:p>
+      <text:p text:style-name="Definition_20_Definition">computer</text:p>
+      <text:p text:style-name="Definition_20_Term">orange</text:p>
+      <text:p text:style-name="Definition_20_Definition">orange fruit</text:p>
+      <text:list text:style-name="L25">
+        <text:list-item>
+          <text:p text:style-name="P44">sublist</text:p>
+        </text:list-item>
+        <text:list-item>
+          <text:p text:style-name="P44">sublist</text:p>
+        </text:list-item>
+      </text:list>
       <text:h text:style-name="Heading_20_1" text:outline-level="1">HTML
                                                                     Blocks</text:h>
       <text:p text:style-name="Text_20_body">Simple block on one
@@ -1289,22 +1328,22 @@
       <text:p text:style-name="Text_20_body">foo</text:p>
       <text:p text:style-name="Text_20_body">This should be a code block,
                                              though:</text:p>
-      <text:p text:style-name="P44">&lt;div&gt;</text:p>
-      <text:p text:style-name="P45"><text:s text:c="4" />foo</text:p>
-      <text:p text:style-name="P46">&lt;/div&gt;</text:p>
+      <text:p text:style-name="P45">&lt;div&gt;</text:p>
+      <text:p text:style-name="P46"><text:s text:c="4" />foo</text:p>
+      <text:p text:style-name="P47">&lt;/div&gt;</text:p>
       <text:p text:style-name="Text_20_body">As should this:</text:p>
-      <text:p text:style-name="P47">&lt;div&gt;foo&lt;/div&gt;</text:p>
+      <text:p text:style-name="P48">&lt;div&gt;foo&lt;/div&gt;</text:p>
       <text:p text:style-name="Text_20_body">Now, nested:</text:p>
       <text:p text:style-name="Text_20_body">foo</text:p>
       <text:p text:style-name="Text_20_body">This should just be an HTML
                                              comment:</text:p>
       <text:p text:style-name="Text_20_body">Multiline:</text:p>
       <text:p text:style-name="Text_20_body">Code block:</text:p>
-      <text:p text:style-name="P48">&lt;!-- Comment --&gt;</text:p>
+      <text:p text:style-name="P49">&lt;!-- Comment --&gt;</text:p>
       <text:p text:style-name="Text_20_body">Just plain comment, with
                                              trailing spaces on the line:</text:p>
       <text:p text:style-name="Text_20_body">Code:</text:p>
-      <text:p text:style-name="P49">&lt;hr /&gt;</text:p>
+      <text:p text:style-name="P50">&lt;hr /&gt;</text:p>
       <text:p text:style-name="Text_20_body">Hr&#8217;s:</text:p>
       <text:p text:style-name="Horizontal_20_Line" />
       <text:h text:style-name="Heading_20_1" text:outline-level="1">Inline
@@ -1371,46 +1410,46 @@
       <text:p text:style-name="Text_20_body">Ellipses&#8230;and&#8230;and&#8230;.</text:p>
       <text:p text:style-name="Horizontal_20_Line" />
       <text:h text:style-name="Heading_20_1" text:outline-level="1">LaTeX</text:h>
-      <text:list text:style-name="L25">
+      <text:list text:style-name="L26">
         <text:list-item>
-          <text:p text:style-name="P50"><text:span text:style-name="Teletype">\cite[22-23]{smith.1899}</text:span></text:p>
+          <text:p text:style-name="P51"><text:span text:style-name="Teletype">\cite[22-23]{smith.1899}</text:span></text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P50">2+2=4</text:p>
+          <text:p text:style-name="P51">2+2=4</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P50"><text:span text:style-name="T58">x</text:span> ∈ <text:span text:style-name="T59">y</text:span></text:p>
+          <text:p text:style-name="P51"><text:span text:style-name="T58">x</text:span> ∈ <text:span text:style-name="T59">y</text:span></text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P50">α ∧ ω</text:p>
+          <text:p text:style-name="P51">α ∧ ω</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P50">223</text:p>
+          <text:p text:style-name="P51">223</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P50"><text:span text:style-name="T60">p</text:span>-Tree</text:p>
+          <text:p text:style-name="P51"><text:span text:style-name="T60">p</text:span>-Tree</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P50">Here&#8217;s some display math: \frac{<text:span text:style-name="T61">d</text:span>}{<text:span text:style-name="T62">dx</text:span>}<text:span text:style-name="T63">f</text:span>(<text:span text:style-name="T64">x</text:span>)=\lim<text:span text:style-name="T65">h</text:span><text:span text:style-name="T66"> → </text:span><text:span text:style-name="T67">0</text:span>\frac{<text:span text:style-name="T68">f</text:span>(<text:span text:style-name="T69">x</text:span>+<text:span text:style-name="T70">h</text:span>)-<text:span text:style-name="T71">f</text:span>(<text:span text:style-name="T72">x</text:span>)}{<text:span text:style-name="T73">h</text:span>}</text:p>
+          <text:p text:style-name="P51">Here&#8217;s some display math: \frac{<text:span text:style-name="T61">d</text:span>}{<text:span text:style-name="T62">dx</text:span>}<text:span text:style-name="T63">f</text:span>(<text:span text:style-name="T64">x</text:span>)=\lim<text:span text:style-name="T65">h</text:span><text:span text:style-name="T66"> → </text:span><text:span text:style-name="T67">0</text:span>\frac{<text:span text:style-name="T68">f</text:span>(<text:span text:style-name="T69">x</text:span>+<text:span text:style-name="T70">h</text:span>)-<text:span text:style-name="T71">f</text:span>(<text:span text:style-name="T72">x</text:span>)}{<text:span text:style-name="T73">h</text:span>}</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P50">Here&#8217;s one that has a line break in it: α+ω × <text:span text:style-name="T74">x</text:span><text:span text:style-name="T75">2</text:span>.</text:p>
+          <text:p text:style-name="P51">Here&#8217;s one that has a line break in it: α+ω × <text:span text:style-name="T74">x</text:span><text:span text:style-name="T75">2</text:span>.</text:p>
         </text:list-item>
       </text:list>
       <text:p text:style-name="Text_20_body">These shouldn&#8217;t be
                                              math:</text:p>
-      <text:list text:style-name="L26">
+      <text:list text:style-name="L27">
         <text:list-item>
-          <text:p text:style-name="P51">To get the famous equation, write <text:span text:style-name="Teletype">$e = mc^2$</text:span>.</text:p>
+          <text:p text:style-name="P52">To get the famous equation, write <text:span text:style-name="Teletype">$e = mc^2$</text:span>.</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P51">$22,000 is a <text:span text:style-name="T76">lot</text:span> of money. So is $34,000. (It worked if &#8220;lot&#8221; is emphasized.)</text:p>
+          <text:p text:style-name="P52">$22,000 is a <text:span text:style-name="T76">lot</text:span> of money. So is $34,000. (It worked if &#8220;lot&#8221; is emphasized.)</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P51">Shoes ($20) and socks ($5).</text:p>
+          <text:p text:style-name="P52">Shoes ($20) and socks ($5).</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P51">Escaped <text:span text:style-name="Teletype">$</text:span>: $73 <text:span text:style-name="T77">this</text:span><text:span text:style-name="T78"> </text:span><text:span text:style-name="T79">should</text:span><text:span text:style-name="T80"> </text:span><text:span text:style-name="T81">be</text:span><text:span text:style-name="T82"> </text:span><text:span text:style-name="T83">emphasized</text:span> 23$.</text:p>
+          <text:p text:style-name="P52">Escaped <text:span text:style-name="Teletype">$</text:span>: $73 <text:span text:style-name="T77">this</text:span><text:span text:style-name="T78"> </text:span><text:span text:style-name="T79">should</text:span><text:span text:style-name="T80"> </text:span><text:span text:style-name="T81">be</text:span><text:span text:style-name="T82"> </text:span><text:span text:style-name="T83">emphasized</text:span> 23$.</text:p>
         </text:list-item>
       </text:list>
       <text:p text:style-name="Text_20_body">Here&#8217;s a LaTeX
@@ -1425,21 +1464,21 @@
                                                                     Characters</text:h>
       <text:p text:style-name="Text_20_body">Here is some
                                              unicode:</text:p>
-      <text:list text:style-name="L27">
+      <text:list text:style-name="L28">
         <text:list-item>
-          <text:p text:style-name="P52">I hat: Î</text:p>
+          <text:p text:style-name="P53">I hat: Î</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P52">o umlaut: ö</text:p>
+          <text:p text:style-name="P53">o umlaut: ö</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P52">section: §</text:p>
+          <text:p text:style-name="P53">section: §</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P52">set membership: ∈</text:p>
+          <text:p text:style-name="P53">set membership: ∈</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P52">copyright: ©</text:p>
+          <text:p text:style-name="P53">copyright: ©</text:p>
         </text:list-item>
       </text:list>
       <text:p text:style-name="Text_20_body">AT&amp;T has an ampersand in
@@ -1497,7 +1536,7 @@
                                              <text:a xlink:type="simple" xlink:href="/url" office:name=""><text:span text:style-name="Definition">thrice</text:span></text:a>.</text:p>
       <text:p text:style-name="Text_20_body">This should [not][] be a
                                              link.</text:p>
-      <text:p text:style-name="P53">[not]: /url</text:p>
+      <text:p text:style-name="P54">[not]: /url</text:p>
       <text:p text:style-name="Text_20_body">Foo
                                              <text:a xlink:type="simple" xlink:href="/url/" office:name="Title with &quot;quotes&quot; inside"><text:span text:style-name="Definition">bar</text:span></text:a>.</text:p>
       <text:p text:style-name="Text_20_body">Foo
@@ -1516,24 +1555,24 @@
       <text:h text:style-name="Heading_20_2" text:outline-level="2">Autolinks</text:h>
       <text:p text:style-name="Text_20_body">With an ampersand:
                                              <text:a xlink:type="simple" xlink:href="http://example.com/?foo=1&amp;bar=2" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">http://example.com/?foo=1&amp;bar=2</text:span></text:span></text:a></text:p>
-      <text:list text:style-name="L28">
+      <text:list text:style-name="L29">
         <text:list-item>
-          <text:p text:style-name="P54">In a list?</text:p>
+          <text:p text:style-name="P55">In a list?</text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P54"><text:a xlink:type="simple" xlink:href="http://example.com/" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">http://example.com/</text:span></text:span></text:a></text:p>
+          <text:p text:style-name="P55"><text:a xlink:type="simple" xlink:href="http://example.com/" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">http://example.com/</text:span></text:span></text:a></text:p>
         </text:list-item>
         <text:list-item>
-          <text:p text:style-name="P54">It should.</text:p>
+          <text:p text:style-name="P55">It should.</text:p>
         </text:list-item>
       </text:list>
       <text:p text:style-name="Text_20_body">An e-mail address:
                                              <text:a xlink:type="simple" xlink:href="mailto:nobody@nowhere.net" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">nobody@nowhere.net</text:span></text:span></text:a></text:p>
-      <text:p text:style-name="P55">Blockquoted: <text:a xlink:type="simple" xlink:href="http://example.com/" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">http://example.com/</text:span></text:span></text:a></text:p>
+      <text:p text:style-name="P56">Blockquoted: <text:a xlink:type="simple" xlink:href="http://example.com/" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">http://example.com/</text:span></text:span></text:a></text:p>
       <text:p text:style-name="Text_20_body">Auto-links should not occur
                                              here:
                                              <text:span text:style-name="Teletype">&lt;http://example.com/&gt;</text:span></text:p>
-      <text:p text:style-name="P56">or here: &lt;http://example.com/&gt;</text:p>
+      <text:p text:style-name="P57">or here: &lt;http://example.com/&gt;</text:p>
       <text:p text:style-name="Horizontal_20_Line" />
       <text:h text:style-name="Heading_20_1" text:outline-level="1">Images</text:h>
       <text:p text:style-name="Text_20_body">From
@@ -1552,7 +1591,7 @@
                                              another.<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>2</text:note-citation>
                                                                                                           <text:note-body><text:p text:style-name="Footnote">Here&#8217;s the long note. This one contains multiple blocks.</text:p>
                                                                                                                           <text:p text:style-name="Footnote">Subsequent blocks are indented to show that they belong to the footnote (as with list items).</text:p>
-                                                                                                                          <text:p text:style-name="P57"><text:s text:c="2" />{ &lt;code&gt; }</text:p>
+                                                                                                                          <text:p text:style-name="P58"><text:s text:c="2" />{ &lt;code&gt; }</text:p>
                                                                                                                           <text:p text:style-name="Footnote">If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.</text:p></text:note-body></text:note>
                                              This should
                                              <text:span text:style-name="T84">not</text:span> be a
@@ -1560,11 +1599,11 @@
                                              note] Here is an inline
                                              note.<text:note text:id="ftn2" text:note-class="footnote"><text:note-citation>3</text:note-citation>
                                                                                                        <text:note-body><text:p text:style-name="Footnote">This is <text:span text:style-name="T85">easier</text:span> to type. Inline notes may contain <text:a xlink:type="simple" xlink:href="http://google.com" office:name=""><text:span text:style-name="Definition">links</text:span></text:a> and <text:span text:style-name="Teletype">]</text:span> verbatim characters, as well as [bracketed text].</text:p></text:note-body></text:note></text:p>
-      <text:p text:style-name="P58">Notes can go in quotes.<text:note text:id="ftn3" text:note-class="footnote"><text:note-citation>4</text:note-citation>
+      <text:p text:style-name="P59">Notes can go in quotes.<text:note text:id="ftn3" text:note-class="footnote"><text:note-citation>4</text:note-citation>
                                                                                                                 <text:note-body><text:p text:style-name="Footnote">In quote.</text:p></text:note-body></text:note></text:p>
-      <text:list text:style-name="L29">
+      <text:list text:style-name="L30">
         <text:list-item>
-          <text:p text:style-name="P59">And in list items.<text:note text:id="ftn4" text:note-class="footnote"><text:note-citation>5</text:note-citation>
+          <text:p text:style-name="P60">And in list items.<text:note text:id="ftn4" text:note-class="footnote"><text:note-citation>5</text:note-citation>
                                                                                                                <text:note-body><text:p text:style-name="Footnote">In list.</text:p></text:note-body></text:note></text:p>
         </text:list-item>
       </text:list>
diff --git a/tests/writer.rst b/tests/writer.rst
--- a/tests/writer.rst
+++ b/tests/writer.rst
@@ -386,6 +386,43 @@
 
 
 
+Multiple definitions, tight:
+
+apple
+    red fruit
+    computer
+orange
+    orange fruit
+    bank
+
+Multiple definitions, loose:
+
+apple
+    red fruit
+
+    computer
+
+orange
+    orange fruit
+
+    bank
+
+
+Blank line after term, indented marker, alternate markers:
+
+apple
+    red fruit
+
+    computer
+
+orange
+    orange fruit
+
+    
+    1. sublist
+    2. sublist
+
+
 HTML Blocks
 ===========
 
diff --git a/tests/writer.rtf b/tests/writer.rtf
--- a/tests/writer.rtf
+++ b/tests/writer.rtf
@@ -181,6 +181,28 @@
 {\pard \ql \f0 \sa180 \li360 \fi0 orange fruit\par}
 {\pard \ql \f0 \sa180 \li360 \fi0 \f1 \{ orange code block \}\par}
 {\pard \ql \f0 \sa180 \li1080 \fi0 orange block quote\sa180\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Multiple definitions, tight:\par}
+{\pard \ql \f0 \sa0 \li0 \fi0 apple\par}
+{\pard \ql \f0 \sa0 \li360 \fi0 red fruit\par}
+{\pard \ql \f0 \sa0 \li360 \fi0 computer\par}
+{\pard \ql \f0 \sa0 \li0 \fi0 orange\par}
+{\pard \ql \f0 \sa0 \li360 \fi0 orange fruit\par}
+{\pard \ql \f0 \sa0 \li360 \fi0 bank\sa180\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Multiple definitions, loose:\par}
+{\pard \ql \f0 \sa0 \li0 \fi0 apple\par}
+{\pard \ql \f0 \sa180 \li360 \fi0 red fruit\par}
+{\pard \ql \f0 \sa180 \li360 \fi0 computer\par}
+{\pard \ql \f0 \sa0 \li0 \fi0 orange\par}
+{\pard \ql \f0 \sa180 \li360 \fi0 orange fruit\par}
+{\pard \ql \f0 \sa180 \li360 \fi0 bank\sa180\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Blank line after term, indented marker, alternate markers:\par}
+{\pard \ql \f0 \sa0 \li0 \fi0 apple\par}
+{\pard \ql \f0 \sa180 \li360 \fi0 red fruit\par}
+{\pard \ql \f0 \sa180 \li360 \fi0 computer\par}
+{\pard \ql \f0 \sa0 \li0 \fi0 orange\par}
+{\pard \ql \f0 \sa180 \li360 \fi0 orange fruit\par}
+{\pard \ql \f0 \sa0 \li720 \fi-360 1.\tx360\tab sublist\par}
+{\pard \ql \f0 \sa0 \li720 \fi-360 2.\tx360\tab sublist\sa180\sa180\par}
 {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 HTML Blocks\par}
 {\pard \ql \f0 \sa180 \li0 \fi0 Simple block on one line:\par}
 {\pard \ql \f0 \sa0 \li0 \fi0 foo\par}
diff --git a/tests/writer.texinfo b/tests/writer.texinfo
--- a/tests/writer.texinfo
+++ b/tests/writer.texinfo
@@ -1,5 +1,5 @@
 \input texinfo
-
+@documentencoding utf-8
 @macro textstrikeout{text}
 ~~\text\~~
 @end macro
@@ -584,6 +584,58 @@
 orange block quote
 
 @end quotation
+@end table
+
+Multiple definitions@comma{} tight:
+
+@table @asis
+@item apple
+
+red fruit
+computer
+@item orange
+
+orange fruit
+bank
+@end table
+
+Multiple definitions@comma{} loose:
+
+@table @asis
+@item apple
+
+red fruit
+
+computer
+
+@item orange
+
+orange fruit
+
+bank
+
+@end table
+
+Blank line after term@comma{} indented marker@comma{} alternate markers:
+
+@table @asis
+@item apple
+
+red fruit
+
+computer
+
+@item orange
+
+orange fruit
+
+@enumerate 
+@item
+sublist
+@item
+sublist
+@end enumerate
+
 @end table
 
 
