Exemplo n.º 1
0
 public void Initialize(ParserRegistrationContext context)
 {
     context.Register(typeof(FootnoteGroup), ParseFootnoteGroup);
     context.Register(typeof(FootnoteLink), ParseFootnoteLink);
     context.Register(typeof(FootnoteLinkReferenceDefinition), ParseFootnoteLinkReferenceDefinition);
     context.RegisterFinalizer(Finalize);
 }
Exemplo n.º 2
0
        public void Initialize(ParserRegistrationContext context)
        {
            context.Register(typeof(FencedCodeBlock), ParseCodeBlock);

            var configuration    = context.Configuration;
            var codeBlocksConfig = configuration.Parsing.CodeBlocks;

            ParseUndefinedLanguages = codeBlocksConfig.ParseUndefinedLanguages;
            LanguageWhiteListTest   = codeBlocksConfig.LanguageWhiteList;
            LanguageBlackListTest   = codeBlocksConfig.LanguageBlackList;
            Parsers.AddRange(codeBlocksConfig.Parsers);

            if (ParseUndefinedLanguages)
            {
                foreach (var parser in Parsers)
                {
                    if (parser.SupportsUndefinedLanguages)
                    {
                        UndefinedLanguageParsers.Add(parser);
                    }
                }
            }

            foreach (var language in CodeBlocksConfig.CommonLanguages)
            {
                List <ICodeBlockParser> languageParsers = null;
                if (LanguageWhiteListTest(language) && !LanguageBlackListTest(language))
                {
                    languageParsers = new List <ICodeBlockParser>(4);
                    foreach (var parser in Parsers)
                    {
                        if (parser.SupportsLanguage(language))
                        {
                            languageParsers.Add(parser);
                        }
                    }
                    if (languageParsers.Count == 0)
                    {
                        languageParsers = null;
                    }
                }
                CommonLanguages.Add(language, languageParsers);
            }

            foreach (var parser in Parsers)
            {
                parser.Initialize(configuration);
            }
        }
 public void Initialize(ParserRegistrationContext context)
 {
     context.Register(typeof(AutolinkInline), ParseAutoLinkInline);
 }
Exemplo n.º 4
0
 public void Initialize(ParserRegistrationContext context)
 {
     context.Register(typeof(LinkReferenceDefinition), ParseLinkReferenceDefinition);
 }
Exemplo n.º 5
0
 public void Initialize(ParserRegistrationContext context)
 {
     context.Register(typeof(HeadingBlock), ParseHeadingBlock);
 }
Exemplo n.º 6
0
 public void Initialize(ParserRegistrationContext context)
 {
     context.Register(typeof(MarkdownDocument), ParseDocument);
     ParserConfig = context.ReadConfig <CustomConfig>(writeIfDefault: true);
 }
 public void Initialize(ParserRegistrationContext context)
 {
     context.Register(typeof(LiteralInline), ParseLiteralInline);
 }