コード例 #1
0
        protected override void BuildBlockRules()
        {
            base.BuildBlockRules();
            var blockRules = BlockRules.ToList();
            var index      = blockRules.FindLastIndex(s => s is MarkdownNewLineBlockRule);

            if (index < 0)
            {
                throw new ArgumentException($"{nameof(MarkdownNewLineBlockRule)} should exist!");
            }
            blockRules.Insert(index + 1, new DfmYamlHeaderBlockRule());
            blockRules.Insert(index + 2, new AzureIncludeBlockRule());
            blockRules.Insert(index + 3, new AzureNoteBlockRule());
            blockRules.Insert(index + 4, new AzureSelectorBlockRule());

            index = blockRules.FindLastIndex(s => s is MarkdownHtmlBlockRule);
            if (index < 1)
            {
                throw new ArgumentException($"{nameof(MarkdownHtmlBlockRule)} should exist and shouldn't be the first one rule!");
            }
            blockRules.Insert(index - 1, new AzureHtmlMetadataBlockRule());

            var gfmIndex = blockRules.FindIndex(item => item is GfmParagraphBlockRule);

            blockRules[gfmIndex] = new AzureParagraphBlockRule();

            var markdownBlockQuoteIndex = blockRules.FindIndex(item => item is MarkdownBlockquoteBlockRule);

            blockRules[markdownBlockQuoteIndex] = new AzureBlockquoteBlockRule();
            blockRules.Insert(markdownBlockQuoteIndex, new AzureVideoBlockRule());

            BlockRules = blockRules.ToImmutableList();
        }
コード例 #2
0
ファイル: AzureEngineBuilder.cs プロジェクト: ansyral/docfx
        protected override void BuildBlockRules()
        {
            base.BuildBlockRules();
            var blockRules = BlockRules.ToList();
            var index = blockRules.FindLastIndex(s => s is MarkdownNewLineBlockRule);
            if (index < 0)
            {
                throw new ArgumentException($"{nameof(MarkdownNewLineBlockRule)} should exist!");
            }
            blockRules.Insert(index + 1, new AzureIncludeBlockRule());
            blockRules.Insert(index + 2, new AzureNoteBlockRule());

            var gfmIndex = blockRules.FindIndex(item => item is GfmParagraphBlockRule);
            blockRules[gfmIndex] = new AzureParagraphBlockRule();

            var markdownBlockQuoteIndex = blockRules.FindIndex(item => item is MarkdownBlockquoteBlockRule);
            blockRules[markdownBlockQuoteIndex] = new AzureBlockquoteBlockRule();

            BlockRules = blockRules.ToImmutableList();
        }