aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmarkdown.py2
-rw-r--r--tests/markdown-test/inline-html-advanced.html7
-rw-r--r--tests/markdown-test/inline-html-comments.html11
-rw-r--r--tests/markdown-test/inline-html-simple.html55
-rw-r--r--tests/markdown-test/markdown-documentation-basics.html8
-rw-r--r--tests/markdown-test/markdown-syntax.html65
-rw-r--r--tests/misc/CRLF_line_ends.html4
-rw-r--r--tests/misc/comments.html5
-rw-r--r--tests/misc/div.html7
-rw-r--r--tests/misc/hash.html10
-rw-r--r--tests/misc/mismatched-tags.html6
-rw-r--r--tests/misc/more_comments.html6
-rw-r--r--tests/misc/multi-line-tags.html5
-rw-r--r--tests/misc/multiline-comments.html15
-rw-r--r--tests/misc/php.html13
-rw-r--r--tests/misc/pre.html9
-rw-r--r--tests/misc/span.html8
17 files changed, 141 insertions, 95 deletions
diff --git a/markdown.py b/markdown.py
index a835627..93b2bc0 100755
--- a/markdown.py
+++ b/markdown.py
@@ -911,7 +911,7 @@ class RawHtmlTextPostprocessor(TextPostprocessor):
else:
html = HTML_REMOVED_TEXT
- text = text.replace("<p>%s\n</p>" % (HTML_PLACEHOLDER % i),
+ text = text.replace("<p>%s</p>" % (HTML_PLACEHOLDER % i),
html + "\n")
text = text.replace(HTML_PLACEHOLDER % i, html)
return text
diff --git a/tests/markdown-test/inline-html-advanced.html b/tests/markdown-test/inline-html-advanced.html
index 0f922e9..af1dec1 100644
--- a/tests/markdown-test/inline-html-advanced.html
+++ b/tests/markdown-test/inline-html-advanced.html
@@ -1,11 +1,12 @@
<p>Simple block on one line:</p>
-<p><div>foo</div></p>
+<div>foo</div>
+
<p>And nested without indentation:</p>
-<p><div>
+<div>
<div>
<div>
foo
</div>
</div>
<div>bar</div>
-</div></p> \ No newline at end of file
+</div> \ No newline at end of file
diff --git a/tests/markdown-test/inline-html-comments.html b/tests/markdown-test/inline-html-comments.html
index 8b538d6..0d4cad9 100644
--- a/tests/markdown-test/inline-html-comments.html
+++ b/tests/markdown-test/inline-html-comments.html
@@ -1,8 +1,11 @@
<p>Paragraph one.</p>
-<p><!-- This is a simple comment --></p>
-<p><!--
+<!-- This is a simple comment -->
+
+<!--
This is another comment.
---></p>
+-->
+
<p>Paragraph two.</p>
-<p><!-- one comment block -- -- with two comments --></p>
+<!-- one comment block -- -- with two comments -->
+
<p>The end.</p> \ No newline at end of file
diff --git a/tests/markdown-test/inline-html-simple.html b/tests/markdown-test/inline-html-simple.html
index efb50dc..df98803 100644
--- a/tests/markdown-test/inline-html-simple.html
+++ b/tests/markdown-test/inline-html-simple.html
@@ -1,53 +1,66 @@
<p>Here's a simple block:</p>
-<p><div>
+<div>
foo
-</div></p>
+</div>
+
<p>This should be a code block, though:</p>
<pre>
-<code>&lt;div&gt;
+ <code>&lt;div&gt;
foo
&lt;/div&gt;
</code>
</pre>
<p>As should this:</p>
<pre>
-<code>&lt;div&gt;foo&lt;/div&gt;
+ <code>&lt;div&gt;foo&lt;/div&gt;
</code>
</pre>
<p>Now, nested:</p>
-<p><div>
+<div>
<div>
<div>
foo
</div>
</div>
-</div></p>
+</div>
+
<p>This should just be an HTML comment:</p>
-<p><!-- Comment --></p>
+<!-- Comment -->
+
<p>Multiline:</p>
-<p><!--
+<!--
Blah
Blah
---></p>
+-->
+
<p>Code block:</p>
<pre>
-<code>&lt;!-- Comment --&gt;
+ <code>&lt;!-- Comment --&gt;
</code>
</pre>
<p>Just plain comment, with trailing spaces on the line:</p>
-<p><!-- foo --></p>
+<!-- foo -->
+
<p>Code:</p>
<pre>
-<code>&lt;hr /&gt;
+ <code>&lt;hr /&gt;
</code>
</pre>
<p>Hr's:</p>
-<p><hr></p>
-<p><hr/></p>
-<p><hr /></p>
-<p><hr></p>
-<p><hr/></p>
-<p><hr /></p>
-<p><hr class="foo" id="bar" /></p>
-<p><hr class="foo" id="bar"/></p>
-<p><hr class="foo" id="bar" ></p> \ No newline at end of file
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar"/>
+
+<hr class="foo" id="bar" > \ No newline at end of file
diff --git a/tests/markdown-test/markdown-documentation-basics.html b/tests/markdown-test/markdown-documentation-basics.html
index 6755f77..bc654d2 100644
--- a/tests/markdown-test/markdown-documentation-basics.html
+++ b/tests/markdown-test/markdown-documentation-basics.html
@@ -1,11 +1,12 @@
<h1>Markdown: Basics</h1>
-<p><ul id="ProjectSubmenu">
+<ul id="ProjectSubmenu">
<li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
<li><a class="selected" title="Markdown Basics">Basics</a></li>
<li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
<li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
<li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
-</ul></p>
+</ul>
+
<h2>Getting the Gist of Markdown's Formatting Syntax</h2>
<p>This page offers a brief overview of what it's like to use Markdown.
The <a href="/projects/markdown/syntax" title="Markdown Syntax">syntax page</a> provides complete, detailed documentation for
@@ -294,5 +295,4 @@ you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
&amp;lt;/blockquote&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
</code>
-</pre>
-
+</pre> \ No newline at end of file
diff --git a/tests/markdown-test/markdown-syntax.html b/tests/markdown-test/markdown-syntax.html
index b3df92f..a0c12c1 100644
--- a/tests/markdown-test/markdown-syntax.html
+++ b/tests/markdown-test/markdown-syntax.html
@@ -1,11 +1,12 @@
<h1>Markdown: Syntax</h1>
-<p><ul id="ProjectSubmenu">
+<ul id="ProjectSubmenu">
<li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
<li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
<li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
<li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
<li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
-</ul></p>
+</ul>
+
<ul>
<li>
<a href="#overview">Overview</a>
@@ -77,8 +78,10 @@
<strong>Note:</strong> This document is itself written using Markdown; you
can <a href="/projects/markdown/syntax.text">see the source for it by adding '.text' to the URL</a>.</p>
<hr />
-<p><h2 id="overview">Overview</h2></p>
-<p><h3 id="philosophy">Philosophy</h3></p>
+<h2 id="overview">Overview</h2>
+
+<h3 id="philosophy">Philosophy</h3>
+
<p>Markdown is intended to be as easy-to-read and easy-to-write as is feasible.</p>
<p>Readability, however, is emphasized above all else. A Markdown-formatted
document should be publishable as-is, as plain text, without looking
@@ -93,7 +96,8 @@ as to look like what they mean. E.g., asterisks around a word actually
look like *emphasis*. Markdown lists look like, well, lists. Even
blockquotes look like quoted passages of text, assuming you've ever
used email.</p>
-<p><h3 id="html">Inline HTML</h3></p>
+<h3 id="html">Inline HTML</h3>
+
<p>Markdown's syntax is intended for one purpose: to be used as a
format for <em>writing</em> for the web.</p>
<p>Markdown is not a replacement for HTML, or even close to it. Its
@@ -136,7 +140,8 @@ you'd prefer to use HTML <code>&lt;a&gt;</code> or <code>&lt;img&gt;</code> tags
link or image syntax, go right ahead.</p>
<p>Unlike block-level HTML tags, Markdown syntax <em>is</em> processed within
span-level tags.</p>
-<p><h3 id="autoescape">Automatic Escaping for Special Characters</h3></p>
+<h3 id="autoescape">Automatic Escaping for Special Characters</h3>
+
<p>In HTML, there are two characters that demand special treatment: <code>&lt;</code>
and <code>&amp;</code>. Left angle brackets are used to start tags; ampersands are
used to denote HTML entities. If you want to use them as literal
@@ -194,8 +199,10 @@ Markdown to write about HTML code. (As opposed to raw HTML, which is a
terrible format for writing about HTML syntax, because every single <code>&lt;</code>
and <code>&amp;</code> in your example code needs to be escaped.)</p>
<hr />
-<p><h2 id="block">Block Elements</h2></p>
-<p><h3 id="p">Paragraphs and Line Breaks</h3></p>
+<h2 id="block">Block Elements</h2>
+
+<h3 id="p">Paragraphs and Line Breaks</h3>
+
<p>A paragraph is simply one or more consecutive lines of text, separated
by one or more blank lines. (A blank line is any line that looks like a
blank line -- a line containing nothing but spaces or tabs is considered
@@ -211,7 +218,8 @@ end a line with two or more spaces, then type return.</p>
"every line break is a <code>&lt;br /&gt;</code>" rule wouldn't work for Markdown.
Markdown's email-style <a href="#blockquote">blockquoting</a> and multi-paragraph <a href="#list">list items</a>
work best -- and look better -- when you format them with hard breaks.</p>
-<p><h3 id="header">Headers</h3></p>
+<h3 id="header">Headers</h3>
+
<p>Markdown supports two styles of headers, <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a> and <a href="http://www.aaronsw.com/2002/atx/">atx</a>.</p>
<p>Setext-style headers are "underlined" using equal signs (for first-level
headers) and dashes (for second-level headers). For example:</p>
@@ -247,7 +255,8 @@ determines the header level.) :</p>
### This is an H3 ######
</code>
</pre>
-<p><h3 id="blockquote">Blockquotes</h3></p>
+<h3 id="blockquote">Blockquotes</h3>
+
<p>Markdown uses email-style <code>&gt;</code> characters for blockquoting. If you're
familiar with quoting passages of text in an email message, then you
know how to create a blockquote in Markdown. It looks best if you hard
@@ -298,7 +307,8 @@ and code blocks:</p>
<p>Any decent text editor should make email-style quoting easy. For
example, with BBEdit, you can make a selection and choose Increase
Quote Level from the Text menu.</p>
-<p><h3 id="list">Lists</h3></p>
+<h3 id="list">Lists</h3>
+
<p>Markdown supports ordered (numbered) and unordered (bulleted) lists.</p>
<p>Unordered lists use asterisks, pluses, and hyphens -- interchangably
-- as list markers:</p>
@@ -469,7 +479,8 @@ line. To avoid this, you can backslash-escape the period:</p>
<code>1986\. What a great season.
</code>
</pre>
-<p><h3 id="precode">Code Blocks</h3></p>
+<h3 id="precode">Code Blocks</h3>
+
<p>Pre-formatted code blocks are used for writing about programming or
markup source code. Rather than forming normal paragraphs, the lines
of a code block are interpreted literally. Markdown wraps a code block
@@ -534,7 +545,8 @@ ampersands and angle brackets. For example, this:</p>
<p>Regular Markdown syntax is not processed within code blocks. E.g.,
asterisks are just literal asterisks within a code block. This means
it's also easy to use Markdown to write about Markdown's own syntax.</p>
-<p><h3 id="hr">Horizontal Rules</h3></p>
+<h3 id="hr">Horizontal Rules</h3>
+
<p>You can produce a horizontal rule tag (<code>&lt;hr /&gt;</code>) by placing three or
more hyphens, asterisks, or underscores on a line by themselves. If you
wish, you may use spaces between the hyphens or asterisks. Each of the
@@ -554,8 +566,10 @@ _ _ _
</code>
</pre>
<hr />
-<p><h2 id="span">Span Elements</h2></p>
-<p><h3 id="link">Links</h3></p>
+<h2 id="span">Span Elements</h2>
+
+<h3 id="link">Links</h3>
+
<p>Markdown supports two style of links: <em>inline</em> and <em>reference</em>.</p>
<p>In both styles, the link text is delimited by [square brackets].</p>
<p>To create an inline link, use a set of regular parentheses immediately
@@ -707,7 +721,8 @@ closely resembles the final output, as rendered in a browser. By
allowing you to move the markup-related metadata out of the paragraph,
you can add links without interrupting the narrative flow of your
prose.</p>
-<p><h3 id="em">Emphasis</h3></p>
+<h3 id="em">Emphasis</h3>
+
<p>Markdown treats asterisks (<code>*</code>) and underscores (<code>_</code>) as indicators of
emphasis. Text wrapped with one <code>*</code> or <code>_</code> will be wrapped with an
HTML <code>&lt;em&gt;</code> tag; double <code>*</code>'s or <code>_</code>'s will be wrapped with an HTML
@@ -749,7 +764,8 @@ escape it:</p>
<code>\*this text is surrounded by literal asterisks\*
</code>
</pre>
-<p><h3 id="code">Code</h3></p>
+<h3 id="code">Code</h3>
+
<p>To indicate a span of code, wrap it with backtick quotes (<code>`</code>).
Unlike a pre-formatted code block, a code span indicates code within a
normal paragraph. For example:</p>
@@ -812,7 +828,8 @@ tags. Markdown will turn this:</p>
equivalent of &lt;code&gt;&amp;amp;mdash;&lt;/code&gt;.&lt;/p&gt;
</code>
</pre>
-<p><h3 id="img">Images</h3></p>
+<h3 id="img">Images</h3>
+
<p>Admittedly, it's fairly difficult to devise a "natural" syntax for
placing images into a plain text document format.</p>
<p>Markdown uses an image syntax that is intended to resemble the syntax
@@ -848,8 +865,10 @@ are defined using syntax identical to link references:</p>
dimensions of an image; if this is important to you, you can simply
use regular HTML <code>&lt;img&gt;</code> tags.</p>
<hr />
-<p><h2 id="misc">Miscellaneous</h2></p>
-<p><h3 id="autolink">Automatic Links</h3></p>
+<h2 id="misc">Miscellaneous</h2>
+
+<h3 id="autolink">Automatic Links</h3>
+
<p>Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:</p>
<pre>
<code>&lt;http://example.com/&gt;
@@ -881,7 +900,8 @@ spambots. For example, Markdown will turn this:</p>
most, address-harvesting bots, but it definitely won't fool all of
them. It's better than nothing, but an address published in this way
will probably eventually start receiving spam.)</p>
-<p><h3 id="backslash">Backslash Escapes</h3></p>
+<h3 id="backslash">Backslash Escapes</h3>
+
<p>Markdown allows you to use backslash escapes to generate literal
characters which would otherwise have special meaning in Markdown's
formatting syntax. For example, if you wanted to surround a word with
@@ -906,5 +926,4 @@ _ underscore
. dot
! exclamation mark
</code>
-</pre>
-
+</pre> \ No newline at end of file
diff --git a/tests/misc/CRLF_line_ends.html b/tests/misc/CRLF_line_ends.html
index c650e58..a72b1ca 100644
--- a/tests/misc/CRLF_line_ends.html
+++ b/tests/misc/CRLF_line_ends.html
@@ -1,4 +1,4 @@
<p>foo</p>
-<p><div>
+<div>
bar
-</div></p> \ No newline at end of file
+</div> \ No newline at end of file
diff --git a/tests/misc/comments.html b/tests/misc/comments.html
index 7a03e53..005a755 100644
--- a/tests/misc/comments.html
+++ b/tests/misc/comments.html
@@ -1,4 +1,5 @@
<p>X&lt;0</p>
<p>X&gt;0</p>
-<p><!-- A comment --></p>
-<p><div>as if</div></p> \ No newline at end of file
+<!-- A comment -->
+
+<div>as if</div> \ No newline at end of file
diff --git a/tests/misc/div.html b/tests/misc/div.html
index 634136c..acd8eaf 100644
--- a/tests/misc/div.html
+++ b/tests/misc/div.html
@@ -1,5 +1,6 @@
-<p><div id="sidebar"></p>
+<div id="sidebar">
+
<p>
-<em>foo</em>
+ <em>foo</em>
</p>
-<p></div></p> \ No newline at end of file
+</div> \ No newline at end of file
diff --git a/tests/misc/hash.html b/tests/misc/hash.html
index 5e8bffb..1865994 100644
--- a/tests/misc/hash.html
+++ b/tests/misc/hash.html
@@ -1,9 +1,11 @@
<p>a</p>
-<p><pre>
+<pre>
#!/usr/bin/python
-hello</pre></p>
+hello</pre>
+
<p>a</p>
-<p><pre>
+<pre>
!/usr/bin/python
-hello</pre></p>
+hello</pre>
+
<p>a</p> \ No newline at end of file
diff --git a/tests/misc/mismatched-tags.html b/tests/misc/mismatched-tags.html
index edeba33..792a8b9 100644
--- a/tests/misc/mismatched-tags.html
+++ b/tests/misc/mismatched-tags.html
@@ -1,5 +1,3 @@
-<p><p>Some text</p><div>some more text</div>
+<p>Some text</p><div>some more text</div>
-and a bit more
-
-</p> \ No newline at end of file
+<p>and a bit more</p>
diff --git a/tests/misc/more_comments.html b/tests/misc/more_comments.html
index d4430cd..37436c5 100644
--- a/tests/misc/more_comments.html
+++ b/tests/misc/more_comments.html
@@ -1,9 +1,7 @@
-<p><!--asd@asdfd.com>
+<!--asd@asdfd.com>
<!asd@asdfd.com>
<asd!@asdfd.com>
-Test
-
-</p> \ No newline at end of file
+<p>Test</p>
diff --git a/tests/misc/multi-line-tags.html b/tests/misc/multi-line-tags.html
index 6d2d97f..763a050 100644
--- a/tests/misc/multi-line-tags.html
+++ b/tests/misc/multi-line-tags.html
@@ -1,3 +1,4 @@
-<p><div></p>
+<div>
+
<p>asdf asdfasd</p>
-<p></div></p> \ No newline at end of file
+</div> \ No newline at end of file
diff --git a/tests/misc/multiline-comments.html b/tests/misc/multiline-comments.html
index 429e71b..547ba0b 100644
--- a/tests/misc/multiline-comments.html
+++ b/tests/misc/multiline-comments.html
@@ -1,13 +1,16 @@
-<p><!--
+<!--
foo
---></p>
-<p><p>
+-->
+
+<p>
foo
-</p></p>
-<p><div></p>
+</p>
+
+<div>
+
<p>foo</p>
-<p></div></p> \ No newline at end of file
+</div> \ No newline at end of file
diff --git a/tests/misc/php.html b/tests/misc/php.html
index 66bc8d1..6d91404 100644
--- a/tests/misc/php.html
+++ b/tests/misc/php.html
@@ -1,9 +1,12 @@
-<p><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
-<b>This should have a p tag</b>
+<p><b>This should have a p tag</b></p>
+
+<!--This is a comment -->
+
+<div>This shouldn't</div>
+
+<?php echo "block_level";?>
-<!--This is a comment --></p>
-<p><div>This shouldn't</div></p>
-<p><?php echo "block_level";?></p>
<p> &lt;?php echo "not_block_level";?&gt;</p>
diff --git a/tests/misc/pre.html b/tests/misc/pre.html
index 5ac9799..a44ae12 100644
--- a/tests/misc/pre.html
+++ b/tests/misc/pre.html
@@ -1,12 +1,13 @@
-<p><pre>
+<pre>
aaa
bbb
-</pre></p>
-<p><pre>
+</pre>
+
+<pre>
* and this is pre-formatted content
* and it should be printed just like this
* and not formatted as a list
-</pre></p> \ No newline at end of file
+</pre> \ No newline at end of file
diff --git a/tests/misc/span.html b/tests/misc/span.html
index dadf5df..bafcf0f 100644
--- a/tests/misc/span.html
+++ b/tests/misc/span.html
@@ -1,4 +1,6 @@
<p><span id="someId"> Foo <em>bar</em> Baz </span></p>
-<p><div><b>*foo*</b></div></p>
-<p><div id="someId"> Foo *bar* Baz </div></p>
-<p><baza id="someId"> Foo <em>bar</em> Baz </baza></p>
+<div><b>*foo*</b></div>
+
+<div id="someId"> Foo *bar* Baz </div>
+
+<p><baza id="someId"> Foo <em>bar</em> Baz </baza></p> \ No newline at end of file