本文整理汇总了C#中MarkdownDeep.Markdown.GetStringBuilder方法的典型用法代码示例。如果您正苦于以下问题:C# Markdown.GetStringBuilder方法的具体用法?C# Markdown.GetStringBuilder怎么用?C# Markdown.GetStringBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarkdownDeep.Markdown
的用法示例。
在下文中一共展示了Markdown.GetStringBuilder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderLink
internal void RenderLink(Markdown m, StringBuilder b, string link_text)
{
if (url.StartsWith("mailto:"))
{
b.Append("<a href=\"");
Utils.HtmlRandomize(b, url);
b.Append('\"');
//if (!String.IsNullOrEmpty(title))
if (null != title && title != System.String.Empty)
{
b.Append(" title=\"");
Utils.SmartHtmlEncodeAmpsAndAngles(b, title);
b.Append('\"');
}
b.Append('>');
Utils.HtmlRandomize(b, link_text);
b.Append("</a>");
}
else
{
HtmlTag tag = new HtmlTag("a");
// encode url
StringBuilder sb = m.GetStringBuilder();
Utils.SmartHtmlEncodeAmpsAndAngles(sb, url);
tag.attributes["href"] = sb.ToString();
// encode title
//if (!String.IsNullOrEmpty(title ))
if (null != title && title != System.String.Empty)
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, title);
tag.attributes["title"] = sb.ToString();
}
// Do user processing
m.OnPrepareLink(tag);
// Render the opening tag
tag.RenderOpening(b);
b.Append(link_text); // Link text already escaped by SpanFormatter
b.Append("</a>");
}
}
示例2: RenderImg
internal void RenderImg(Markdown m, StringBuilder b, string alt_text)
{
HtmlTag tag = new HtmlTag("img");
// encode url
StringBuilder sb = m.GetStringBuilder();
Utils.SmartHtmlEncodeAmpsAndAngles(sb, url);
tag.attributes["src"] = sb.ToString();
// encode alt text
if (!String.IsNullOrEmpty(alt_text))
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, alt_text);
tag.attributes["alt"] = sb.ToString();
}
// encode title
if (!String.IsNullOrEmpty(title))
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, title);
tag.attributes["title"] = sb.ToString();
}
tag.closed = true;
m.OnPrepareImage(tag, m.RenderingTitledImage);
tag.RenderOpening(b);
}
示例3: RenderVideo
internal void RenderVideo(Markdown m, StringBuilder b, string alt_text)
{
HtmlTag tag = new HtmlTag("video");
tag.attributes ["controls"] = "controls";
// encode url
StringBuilder sb = m.GetStringBuilder();
Utils.SmartHtmlEncodeAmpsAndAngles(sb, url);
HtmlTag source = new HtmlTag("source");
source.attributes["src"] = sb.ToString();
m.OnPrepareVideoSource(source);
// encode alt text
if (!String.IsNullOrEmpty(alt_text))
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, alt_text);
tag.attributes["alt"] = sb.ToString();
}
// encode title
if (!String.IsNullOrEmpty(title))
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, title);
tag.attributes["title"] = sb.ToString();
}
tag.closed = true;
tag.RenderOpening(b);
source.RenderOpening (b);
tag.RenderClosing (b);
}
示例4: RenderAudio
internal void RenderAudio(Markdown m, StringBuilder b, string alt_text)
{
HtmlTag tag = new HtmlTag("audio");
tag.attributes ["controls"] = "controls";
// encode url
StringBuilder sb = m.GetStringBuilder();
Utils.SmartHtmlEncodeAmpsAndAngles(sb, url);
tag.attributes["src"] = sb.ToString();
// encode alt text
if (!String.IsNullOrEmpty(alt_text))
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, alt_text);
tag.attributes["alt"] = sb.ToString();
}
// encode title
if (!String.IsNullOrEmpty(title))
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, title);
tag.attributes["title"] = sb.ToString();
}
tag.RenderOpening (b);
tag.RenderClosing (b);
}
示例5: RenderLink
internal void RenderLink(Markdown m, StringBuilder b, string link_text, List<string> specialAttributes)
{
if (this.Url.StartsWith("mailto:"))
{
b.Append("<a href=\"");
Utils.HtmlRandomize(b, this.Url);
b.Append('\"');
if (!String.IsNullOrEmpty(this.Title))
{
b.Append(" title=\"");
Utils.SmartHtmlEncodeAmpsAndAngles(b, this.Title);
b.Append('\"');
}
b.Append('>');
Utils.HtmlRandomize(b, link_text);
b.Append("</a>");
}
else
{
HtmlTag tag = new HtmlTag("a");
// encode url
StringBuilder sb = m.GetStringBuilder();
Utils.SmartHtmlEncodeAmpsAndAngles(sb, this.Url);
tag.attributes["href"] = sb.ToString();
// encode title
if (!String.IsNullOrEmpty(this.Title ))
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, this.Title);
tag.attributes["title"] = sb.ToString();
}
if(specialAttributes.Any())
{
LinkDefinition.HandleSpecialAttributes(specialAttributes, sb, tag);
}
// Do user processing
m.OnPrepareLink(tag);
// Render the opening tag
tag.RenderOpening(b);
b.Append(link_text); // Link text already escaped by SpanFormatter
b.Append("</a>");
}
}
示例6: RenderImg
internal void RenderImg(Markdown m, StringBuilder b, string alt_text, List<string> specialAttributes)
{
HtmlTag tag = new HtmlTag("img");
// encode url
StringBuilder sb = m.GetStringBuilder();
Utils.SmartHtmlEncodeAmpsAndAngles(sb, Url);
tag.attributes["src"] = sb.ToString();
// encode alt text
if (!String.IsNullOrEmpty(alt_text))
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, alt_text);
tag.attributes["alt"] = sb.ToString();
}
// encode title
if (!String.IsNullOrEmpty(Title))
{
sb.Length = 0;
Utils.SmartHtmlEncodeAmpsAndAngles(sb, Title);
tag.attributes["title"] = sb.ToString();
}
if(specialAttributes.Any())
{
LinkDefinition.HandleSpecialAttributes(specialAttributes, sb, tag);
}
tag.closed = true;
m.OnPrepareImage(tag, m.RenderingTitledImage);
tag.RenderOpening(b);
}