Exemplo n.º 1
0
        public override HtmlObject AnalyzeToken(string line, MdTokenType token)
        {
            switch (token)
            {
            case MdTokenType.Image:
                var match = NoStartHyperlinkRegex.Match(line);
                var node  = new HtmlNode("img");
                node.AddAttribute(new HtmlAttribute("src", match.Groups[2].Value));
                node.AddAttribute(new HtmlAttribute("alt", match.Groups[1].Value));
                return(node);

            default:
                return(new HtmlString(line, HtmlEscapeOption.Auto));
            }
        }
Exemplo n.º 2
0
        private void AddAlign(HtmlNode node, Align align)
        {
            switch (align)
            {
            case Align.Left:
                node.AddAttribute(new HtmlAttribute("style", "text-align:left"));
                break;

            case Align.Center:
                node.AddAttribute(new HtmlAttribute("style", "text-align:center"));
                break;

            case Align.Right:
                node.AddAttribute(new HtmlAttribute("style", "text-align:right"));
                break;
            }
        }
Exemplo n.º 3
0
        public override HtmlNode ToHtmlNode()
        {
            HtmlNode code = new HtmlNode("code", new HtmlString(string.Join(Environment.NewLine, lines), HtmlEscapeOption.All));

            if (codeType != null)
            {
                code.AddAttribute(new HtmlAttribute("lang", codeType));
            }
            return(new HtmlNode("pre", code));
        }