浏览代码

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

tags/0.8.0
Frans Bouma 10 年前
父节点
当前提交
06937f67ad
共有 2 个文件被更改,包括 7 次插入4 次删除
  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
文件差异内容过多而无法显示
查看文件


+ 6
- 3
src/MarkdownSharp.cs 查看文件

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

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

text = FormParagraphs(text, unhash: unhash);

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

@@ -1760,7 +1760,8 @@ namespace Docnet
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>
/// Encode/escape certain Markdown characters inside code blocks and spans where they are literals
@@ -1782,6 +1783,8 @@ namespace Docnet
return "&lt;";
case ">":
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
default:
return _escapeTable[match.Value];


正在加载...
取消
保存