Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NormalizeRenderer"/> class.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="options">The normalize options</param>
        public NormalizeRenderer(TextWriter writer, NormalizeOptions options = null) : base(writer)
        {
            Options = options ?? new NormalizeOptions();
            // Default block renderers
            ObjectRenderers.Add(new CodeBlockRenderer());
            ObjectRenderers.Add(new ListRenderer());
            ObjectRenderers.Add(new HeadingRenderer());
            ObjectRenderers.Add(new HtmlBlockRenderer());
            ObjectRenderers.Add(new ParagraphRenderer());
            ObjectRenderers.Add(new QuoteBlockRenderer());
            ObjectRenderers.Add(new ThematicBreakRenderer());
            ObjectRenderers.Add(new LinkReferenceDefinitionGroupRenderer());
            ObjectRenderers.Add(new LinkReferenceDefinitionRenderer());

            // Default inline renderers
            ObjectRenderers.Add(new AutolinkInlineRenderer());
            ObjectRenderers.Add(new CodeInlineRenderer());
            ObjectRenderers.Add(new DelimiterInlineRenderer());
            ObjectRenderers.Add(new EmphasisInlineRenderer());
            ObjectRenderers.Add(new LineBreakInlineRenderer());
            ObjectRenderers.Add(new NormalizeHtmlInlineRenderer());
            ObjectRenderers.Add(new NormalizeHtmlEntityInlineRenderer());
            ObjectRenderers.Add(new LinkInlineRenderer());
            ObjectRenderers.Add(new LiteralInlineRenderer());
        }
Пример #2
0
        static Renderer()
        {
            _NormalizeOptions = new Nr.NormalizeOptions
            {
                ListItemCharacter = '-',
            };
            var builder = new MarkdownPipelineBuilder();

            builder.DisableHtml();
            builder.BlockParsers.RemoveAll(bp => !(bp is Markdig.Parsers.ParagraphBlockParser));
            builder.UseAutoLinks();
            _Pipeline = builder.Build();
        }