Пример #1
0
        private InlineProcessor BuidProcessor()
        {
            var p  = new WikiLinkParser();
            var pr = new InlineProcessor(new StringBuilderCache(), new MarkdownDocument(), new InlineParserList(Enumerable.Empty <InlineParser>()), false);

            return(pr);
        }
Пример #2
0
        private bool TryParse(string markdown, out LinkInline link, bool?includeTrailingCharacters = null, char?whiteSpaceUrlChar = null)
        {
            var pr = BuidProcessor();
            var sl = new StringSlice(markdown);

            var p = new WikiLinkParser()
            {
                Extension = ".html"
            };

            if (includeTrailingCharacters != null)
            {
                p.IncludeTrailingCharacters = includeTrailingCharacters.Value;
            }
            if (whiteSpaceUrlChar != null)
            {
                p.WhiteSpaceUrlChar = whiteSpaceUrlChar.Value;
            }

            var b = p.Match(pr, ref sl);

            if (b)
            {
                link = (LinkInline)pr.Inline;
            }
            else
            {
                link = null;
            }

            return(b);
        }
Пример #3
0
        public void Setup(MarkdownPipelineBuilder pipeline)
        {
            if (!pipeline.InlineParsers.Contains <WikiLinkParser>())
            {
                var parser = new WikiLinkParser()
                {
                    Extension = Extension,
                    IncludeTrailingCharacters = IncludeTrailingCharacters
                };

                pipeline.InlineParsers.Insert(0, parser);
            }
        }