Permalink
Browse files

Updated README to point out that Markdown.cs is MIT licensed, since i…

…t is a derivative work of MarkdownSharp.

Updated the markdown parser and Markdown.cs to better handle code blocks (multiple endlines after the codeblock) and headers that are on the last line of the file (not a problem for regular Markdown.cs, because it adds a few endlines at the end of the file before parsing).
  • Loading branch information...
1 parent fd23dc4 commit 7c66c18077962bd378449e22f74d48ec7d212d70 Noah Richards committed Jan 13, 2010
Showing with 8 additions and 4 deletions.
  1. +1 −1 Markdown.cs
  2. +4 −2 MarkdownParser.cs
  3. +3 −1 README.markdown
View
@@ -387,7 +387,7 @@ static Markdown()
(.+?) # $2 = Header text
[ \t]*
\#* # optional closing #'s (not counted)
- \n+",
+ (?:\z|\n+)",
RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
View
@@ -58,6 +58,8 @@ static class MarkdownParser
| # ... or it starts at the beginning of the string, followed by an optional newline
\A(?:\r\n|\r|\n)?)";
+ const string ParagraphEndRegexPart = @"(?:(?:(?:\r\n){1,}|\r{1,}|\n{1,})|\Z)";
+
static Regex ParserListTopLevelRegex = new Regex(ParagraphStartRegexPart + Markdown.WholeListRegex,
RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
@@ -68,8 +70,8 @@ static class MarkdownParser
.*\n+
)+
)
- ((?=^[ ]{{0,{0}}}\S)|\Z) # Lookahead for non-space at line-start, or end of doc",
- Markdown.TabWidth), RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
+ ((?=^[ ]{{0,{0}}}\S)|{1}) # Lookahead for non-space at line-start, or end of doc",
+ Markdown.TabWidth, ParagraphEndRegexPart), RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
#region Markdown public parser interface
View
@@ -13,7 +13,9 @@ Here are the existing features:
* **Preview tool window**, so you can see live updates of what you are typing
* **HTML colorization**, for regular HTML elements (that Markdown will just pass through to the output).
-All source code is released under the [Ms-PL license](http://www.opensource.org/licenses/ms-pl.html).
+Markdown.cs is released under the MIT license, which can be found in that file, as it is a derivative work of [MarkdownSharp][].
+
+All other source code is released under the [Ms-PL license](http://www.opensource.org/licenses/ms-pl.html).
Thanks to [John Gruber][john-gruber] for giving me permission to use the term Markdown in reference to this extension.

0 comments on commit 7c66c18

Please sign in to comment.