/// <summary>
        /// Initializes a new instance of the <see cref="MarkdownPipeline" /> class.
        /// </summary>
        public MarkdownPipelineBuilder()
        {
            // Add all default parsers
            BlockParsers = new BlockParserList()
            {
                new ThematicBreakParser(),
                new HeadingBlockParser(),
                new QuoteBlockParser(),
                new ListBlockParser(),

                new HtmlBlockParser(),
                new FencedCodeBlockParser(),
                new IndentedCodeBlockParser(),
                new ParagraphBlockParser(),
            };

            InlineParsers = new InlineParserList()
            {
                new HtmlEntityParser(),
                new LinkInlineParser(),
                new EscapeInlineParser(),
                new EmphasisInlineParser(),
                new CodeInlineParser(),
                new AutolineInlineParser(),
                new LineBreakInlineParser(),
            };

            Extensions = new OrderedList <IMarkdownExtension>();

            StringBuilderCache = new StringBuilderCache();
        }
 // BlockProcessor can't be mocked since its members aren't virtual. Markdig does not apply IOC conventions either, so there is not interface to mock.
 public static InlineProcessor CreateInlineProcessor(
     StringBuilderCache stringBuilderCache = null,
     MarkdownDocument markdownDocument     = null,
     InlineParserList inlineParsers        = null,
     bool preciseSourceLocation            = false)
 {
     return(new InlineProcessor(
                stringBuilderCache ?? new StringBuilderCache(),
                markdownDocument ?? new MarkdownDocument(),
                inlineParsers ?? new InlineParserList(new InlineParser[0]),
                preciseSourceLocation,
                null));
 }
Пример #3
0
        // This class is immutable

        /// <summary>
        /// Initializes a new instance of the <see cref="MarkdownPipeline" /> class.
        /// </summary>
        internal MarkdownPipeline(OrderedList <IMarkdownExtension> extensions, BlockParserList blockParsers, InlineParserList inlineParsers, TextWriter debugLog, ProcessDocumentDelegate documentProcessed)
        {
            if (blockParsers == null)
            {
                ThrowHelper.ArgumentNullException(nameof(blockParsers));
            }
            if (inlineParsers == null)
            {
                ThrowHelper.ArgumentNullException(nameof(inlineParsers));
            }
            // Add all default parsers
            Extensions        = extensions;
            BlockParsers      = blockParsers;
            InlineParsers     = inlineParsers;
            DebugLog          = debugLog;
            DocumentProcessed = documentProcessed;
        }
Пример #4
0
        // This class is immutable

        /// <summary>
        /// Initializes a new instance of the <see cref="MarkdownPipeline" /> class.
        /// </summary>
        internal MarkdownPipeline(OrderedList <IMarkdownExtension> extensions, BlockParserList blockParsers, InlineParserList inlineParsers, StringBuilderCache cache, TextWriter debugLog, ProcessDocumentDelegate documentProcessed)
        {
            // Add all default parsers
            Extensions         = extensions;
            BlockParsers       = blockParsers ?? throw new ArgumentNullException(nameof(blockParsers));
            InlineParsers      = inlineParsers ?? throw new ArgumentNullException(nameof(inlineParsers));
            StringBuilderCache = cache;
            DebugLog           = debugLog;
            DocumentProcessed  = documentProcessed;
        }