Permalink
Browse files

Improved

  • Loading branch information...
1 parent 5757519 commit 86c711f9fa8dcf448770d8da05e072bc068ca295 @Dynalon committed Oct 4, 2012
Showing with 16 additions and 3 deletions.
  1. +0 −1 .gitignore
  2. +4 −1 MarkdownSharp/Markdown.cs
  3. +12 −1 MarkdownSharpTests/SimpleTests.cs
View
1 .gitignore
@@ -7,4 +7,3 @@ bin/
*.userprefs
*.DS_Store
*.AppleDouble
-*.actual.html
View
5 MarkdownSharp/Markdown.cs
@@ -396,11 +396,14 @@ protected string DoAddBumper (string text)
/// </summary>
private string RunBlockGamut(string text)
{
+ text = DoBlockQuotes(text);
+ // save those blockquotes from DoAddBumper
+ text = HashHTMLBlocks (text);
+
text = DoHeaders(text);
text = DoHorizontalRules(text);
text = DoLists(text);
- text = DoBlockQuotes(text);
text = DoAddBumper (text);
// We already ran HashHTMLBlocks() before, in Markdown(), but that
View
13 MarkdownSharpTests/SimpleTests.cs
@@ -264,11 +264,22 @@ public void AutoNewLines ()
[Test]
public void ReplaceOverlongSpacesBySpan ()
{
- string input = "This text has overlong spaces.\n";
+ string input = "This text has overlong spaces.\n";
string expected= "<p>This text has<span class='bumper'>overlong spaces.</span></p>\n";
string actual = m.Transform (input);
Assert.AreEqual (expected, actual);
}
+ [Test]
+ public void GitHubLikeCodeBlocks ()
+ {
+ // test if codeblock with three backticks are correctly encoded
+ // note that it is correct that the first linebreak after ``` gets removed
+ string input = "```\nCodeBlock\n```";
+ string expected = "<pre><code>CodeBlock\n</code></pre>\n";
+
+ string actual = m.Transform (input);
+ Assert.AreEqual (expected, actual);
+ }
}
}

0 comments on commit 86c711f

Please sign in to comment.