Browse Source

Fixed issue with '@' in codeblocks, added more languages to highlight.js

tags/0.8.0
Frans Bouma 10 years ago
parent
commit
06937f67ad
2 changed files with 7 additions and 4 deletions
  1. +1
    -1
      Themes/Default/Destination/js/highlight.pack.js
  2. +6
    -3
      src/MarkdownSharp.cs

+ 1
- 1
Themes/Default/Destination/js/highlight.pack.js
File diff suppressed because it is too large
View File


+ 6
- 3
src/MarkdownSharp.cs View File

@@ -390,11 +390,9 @@ namespace Docnet
text = DoHeaders(text); text = DoHeaders(text);
text = DoHorizontalRules(text); text = DoHorizontalRules(text);
text = DoLists(text); text = DoLists(text);
text = DoAlertBlocks(text);
text = DoGithubCodeBlocks(text); text = DoGithubCodeBlocks(text);
text = DoCodeBlocks(text); text = DoCodeBlocks(text);
text = DoBlockQuotes(text); text = DoBlockQuotes(text);
text = DoTabsBlocks(text);


// We already ran HashHTMLBlocks() before, in Markdown(), but that // We already ran HashHTMLBlocks() before, in Markdown(), but that
// was to escape raw HTML in the original Markdown source. This time, // was to escape raw HTML in the original Markdown source. This time,
@@ -404,6 +402,8 @@ namespace Docnet


text = FormParagraphs(text, unhash: unhash); text = FormParagraphs(text, unhash: unhash);


text = DoAlertBlocks(text);
text = DoTabsBlocks(text);
return text; return text;
} }


@@ -1760,7 +1760,8 @@ namespace Docnet
return sb.ToString(); return sb.ToString();
} }


private static Regex _codeEncoder = new Regex(@"&|<|>|\\|\*|_|\{|\}|\[|\]", RegexOptions.Compiled);
// all characters you want to encode in a codeblock to this regexp.
private static Regex _codeEncoder = new Regex(@"&|<|>|@|\\|\*|_|\{|\}|\[|\]", RegexOptions.Compiled);


/// <summary> /// <summary>
/// Encode/escape certain Markdown characters inside code blocks and spans where they are literals /// Encode/escape certain Markdown characters inside code blocks and spans where they are literals
@@ -1782,6 +1783,8 @@ namespace Docnet
return "&lt;"; return "&lt;";
case ">": case ">":
return "&gt;"; return "&gt;";
case "@":
return "&#64;"; // this is necessary so our extensions to markdown which start with @ are left alone in a code block.
// escape characters that are magic in Markdown // escape characters that are magic in Markdown
default: default:
return _escapeTable[match.Value]; return _escapeTable[match.Value];


Loading…
Cancel
Save