本文整理汇总了C#中MarkdownDeep.Markdown.HtmlEncodeAndConvertTabsToSpaces方法的典型用法代码示例。如果您正苦于以下问题:C# Markdown.HtmlEncodeAndConvertTabsToSpaces方法的具体用法?C# Markdown.HtmlEncodeAndConvertTabsToSpaces怎么用?C# Markdown.HtmlEncodeAndConvertTabsToSpaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarkdownDeep.Markdown
的用法示例。
在下文中一共展示了Markdown.HtmlEncodeAndConvertTabsToSpaces方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
//.........这里部分代码省略.........
m.SpanFormatter.Format(b, l.Trim());
b.Append("</dt>\n");
}
}
else
{
b.Append("<dt>\n");
RenderChildren(m, b);
b.Append("</dt>\n");
}
break;
}
case BlockType.dl:
b.Append("<dl>\n");
RenderChildren(m, b);
b.Append("</dl>\n");
return;
case BlockType.html:
b.Append(buf, contentStart, contentLen);
return;
case BlockType.unsafe_html:
m.HtmlEncode(b, buf, contentStart, contentLen);
return;
case BlockType.codeblock:
if (m.FormatCodeBlock != null)
{
var sb = new StringBuilder();
foreach (var line in children)
{
m.HtmlEncodeAndConvertTabsToSpaces(sb, line.buf, line.contentStart, line.contentLen);
sb.Append("\n");
}
b.Append(m.FormatCodeBlock(m, sb.ToString()));
}
else
{
b.Append("<pre><code>");
foreach (var line in children)
{
m.HtmlEncodeAndConvertTabsToSpaces(b, line.buf, line.contentStart, line.contentLen);
b.Append("\n");
}
b.Append("</code></pre>\n\n");
}
return;
case BlockType.quote:
b.Append("<blockquote>\n");
RenderChildren(m, b);
b.Append("</blockquote>\n");
return;
case BlockType.li:
b.Append("<li>\n");
RenderChildren(m, b);
b.Append("</li>\n");
return;
case BlockType.ol:
b.Append("<ol>\n");
RenderChildren(m, b);
b.Append("</ol>\n");
示例2: RenderCodeBlock
internal void RenderCodeBlock(Markdown m, StringBuilder b)
{
if (m.FormatCodeBlock != null)
{
var sb = new StringBuilder();
foreach (var line in children)
{
m.HtmlEncodeAndConvertTabsToSpaces(sb, line.buf, line.contentStart, line.contentLen);
sb.Append(RenderTokens.NewLine);
}
b.Append(m.FormatCodeBlock(m, sb.ToString()));
}
else
{
var attr = string.Empty;
if (m.ExtraMode && !string.IsNullOrEmpty(this.codeBlockLang))
{
attr = string.Format(RenderTokens.ClassAttr, this.codeBlockLang);
}
b.Append(string.Format(RenderTokens.CodeBlockStart, attr));
foreach (var line in children)
{
m.HtmlEncodeAndConvertTabsToSpaces(b, line.buf, line.contentStart, line.contentLen);
b.Append(RenderTokens.NewLine);
}
b.Append(RenderTokens.CodeBlockEnd);
}
return;
}
示例3: Render
//.........这里部分代码省略.........
case BlockType.html:
b.Append(Buf, ContentStart, ContentLen);
return;
case BlockType.unsafe_html:
m.HtmlEncode(b, Buf, ContentStart, ContentLen);
return;
case BlockType.codeblock:
if(m.FormatCodeBlockFunc == null)
{
var dataArgument = this.Data as string ?? string.Empty;
string tagSuffix = "</code></pre>\n\n";
if(m.GitHubCodeBlocks && !string.IsNullOrWhiteSpace(dataArgument))
{
if(dataArgument == "nohighlight")
{
b.Append("<pre class=\"nocode\">");
tagSuffix = "</pre>";
}
else
{
b.AppendFormat("<pre><code class=\"{0}\">", dataArgument);
}
}
else
{
b.Append("<pre><code>");
}
foreach(var line in Children)
{
m.HtmlEncodeAndConvertTabsToSpaces(b, line.Buf, line.ContentStart, line.ContentLen);
b.Append("\n");
}
b.Append(tagSuffix);
}
else
{
var sb = new StringBuilder();
foreach(var line in Children)
{
m.HtmlEncodeAndConvertTabsToSpaces(sb, line.Buf, line.ContentStart, line.ContentLen);
sb.Append("\n");
}
b.Append(m.FormatCodeBlockFunc(m, sb.ToString()));
}
return;
case BlockType.quote:
b.Append("<blockquote>\n");
RenderChildren(m, b);
b.Append("</blockquote>\n");
return;
case BlockType.li:
b.Append("<li>\n");
RenderChildren(m, b);
b.Append("</li>\n");
return;
case BlockType.ol:
b.Append("<ol>\n");
RenderChildren(m, b);
b.Append("</ol>\n");