public string Render(Node node) { string content = node.Nodes.Any() ? nodeListRenderer.Render(node.Nodes) : NodeListRenderer.Sanitize(node.Content); return($"<em>{content}</em>"); }
public static string Convert(string wikiText, ConverterConfiguration configuration) { var nodesRenderer = new NodeListRenderer(); nodesRenderer.ImagesBaseUrl = configuration.ImagesBaseUrl; nodesRenderer.ImageLeftAlignCssClass = configuration.ImageLeftAlignCssClass; nodesRenderer.ImageRightAlignCssClass = configuration.ImageRightAlignCssClass; nodesRenderer.ImageCenterAlignCssClass = configuration.ImageCenterAlignCssClass; return(nodesRenderer.Render(new Parser().Parse(wikiText))); }
public string Render(Node node) { string content = node.Nodes.Any() ? nodeListRenderer.Render(node.Nodes) : NodeListRenderer.Sanitize(node.Content); if (!content.EndsWith("\n")) { content += "\n"; } return("<p>\n" + content + "</p>\n"); }
public string Render(Node node) { if (node.Nodes == null || !node.Nodes.Any()) { return(string.Empty); } var content = "<ul>\n"; var currentLevel = 1; var spaceIndent = string.Empty; foreach (ListNode listNode in node.Nodes) { if (listNode.Level > currentLevel) { content += spaceIndent + " <ul>\n"; spaceIndent += " "; } else if (listNode.Level < currentLevel) { spaceIndent = DecrementSpaceIndent(spaceIndent); content += spaceIndent + " </ul>\n"; } var nodeContent = listNode.Nodes.Any() ? nodeListRenderer.Render(listNode.Nodes) : NodeListRenderer.Sanitize(listNode.Content); content += spaceIndent + " <li>" + nodeContent + "</li>\n"; currentLevel = listNode.Level > 1 ? listNode.Level : 1; } var unclosedLevels = spaceIndent.Length; if (unclosedLevels > 0) { for (int i = 0; i < unclosedLevels; i++) { content += spaceIndent + "</ul>\n"; spaceIndent = DecrementSpaceIndent(spaceIndent); } } content += "</ul>\n"; return(content); }
internal BoldText(NodeListRenderer nodeListRenderer) { this.nodeListRenderer = nodeListRenderer; }
public string Render(Node node) { return($"<code>{NodeListRenderer.Sanitize(node.Content)}</code>"); }
public string Render(Node node) { return(NodeListRenderer.Sanitize(node.Content)); }
internal ItalicText(NodeListRenderer nodeListRenderer) { this.nodeListRenderer = nodeListRenderer; }
internal Paragraph(NodeListRenderer nodeListRenderer) { this.nodeListRenderer = nodeListRenderer; }
internal ListBlock(NodeListRenderer nodeListRenderer) { this.nodeListRenderer = nodeListRenderer; }