Ejemplo n.º 1
0
        protected override void Write(NormalizeRenderer renderer, CodeBlock obj)
        {
            if (obj is FencedCodeBlock fencedCodeBlock)
            {
                var opening = new string(fencedCodeBlock.FencedChar, fencedCodeBlock.FencedCharCount);
                renderer.Write(opening);
                if (fencedCodeBlock.Info != null)
                {
                    renderer.Write(fencedCodeBlock.Info);
                }
                if (!string.IsNullOrEmpty(fencedCodeBlock.Arguments))
                {
                    renderer.Write(" ").Write(fencedCodeBlock.Arguments);
                }

                /* TODO do we need this causes a empty space and would render html attributes to markdown.
                 * var attributes = obj.TryGetAttributes();
                 * if (attributes != null)
                 * {
                 *  renderer.Write(" ");
                 *  renderer.Write(attributes);
                 * }
                 */
                renderer.WriteLine();

                renderer.WriteLeafRawLines(obj, true);
                renderer.Write(opening);
            }
            else
            {
                renderer.WriteLeafRawLines(obj, false, true);
            }

            renderer.FinishBlock(renderer.Options.EmptyLineAfterCodeBlock);
        }
Ejemplo n.º 2
0
 protected override void Write(NormalizeRenderer renderer, HtmlBlock obj)
 {
     renderer.WriteLeafRawLines(obj, true, false);
 }