protected StringBuffer RenderTokens(MarkdownEngine engine, ImmutableArray <IMarkdownToken> tokens, MarkdownBlockContext context, bool wrapParagraph = false, IMarkdownRule rule = null) { var content = StringBuffer.Empty; var textContent = StringBuffer.Empty; foreach (var t in tokens) { var text = t as MarkdownTextToken; if (text != null) { if (textContent != StringBuffer.Empty) { textContent += "\n"; } textContent += text.Content; continue; } if (!wrapParagraph && t is MarkdownNewLineBlockToken) { continue; } if (textContent != StringBuffer.Empty) { content += RenderTextInTokens(engine, context, wrapParagraph, rule, textContent); textContent = StringBuffer.Empty; } content += engine.Render(t, context); } if (textContent != StringBuffer.Empty) { content += RenderTextInTokens(engine, context, wrapParagraph, rule, textContent); } return(content); }
public virtual StringBuffer Render(MarkdownEngine engine, MarkdownListBlockToken token, MarkdownBlockContext context) { var type = token.Ordered ? "ol" : "ul"; StringBuffer content = "<"; content += type; content += ">\n"; foreach (var t in token.Tokens) { content += engine.Render(t, context); } return content + "</" + type + ">\n"; }
public virtual StringBuffer Render(MarkdownEngine engine, MarkdownListBlockToken token, MarkdownBlockContext context) { var type = token.Ordered ? "ol" : "ul"; StringBuffer content = "<"; content += type; content += ">\n"; foreach (var t in token.Tokens) { content += engine.Render(t, context); } return(content + "</" + type + ">\n"); }
protected StringBuffer RenderTokens(MarkdownEngine engine, ImmutableArray<IMarkdownToken> tokens, MarkdownBlockContext context, bool wrapParagraph = false, IMarkdownRule rule = null) { var content = StringBuffer.Empty; var textContent = StringBuffer.Empty; foreach (var t in tokens) { var text = t as MarkdownTextToken; if (text != null) { if (textContent != StringBuffer.Empty) { textContent += "\n"; } textContent += text.Content; continue; } if (!wrapParagraph && t is MarkdownNewLineBlockToken) { continue; } if (textContent != StringBuffer.Empty) { content += RenderTextInTokens(engine, context, wrapParagraph, rule, textContent); textContent = StringBuffer.Empty; } content += engine.Render(t, context); } if (textContent != StringBuffer.Empty) { content += RenderTextInTokens(engine, context, wrapParagraph, rule, textContent); } return content; }