예제 #1
0
        public CustomMarkdownScheme(params IReplacer[] additionalReplacers)
        {
            _replacers = new Markdown().Replacers();                                      //originals
            _replacers.RemoveAt(0);                                                       //this is the 'strong' one
            _replacers.RemoveAt(0);                                                       //this is the 'em' one
            _replacers.Insert(0, new PatternReplacer(new Regex("</?(strong|b)>"), "__")); //re-insert with underscore syntax
            _replacers.Insert(0, new PatternReplacer(new Regex("</?(em|i)>"), "_"));      //re-insert with underscore syntax

            //TODO: Find out why lists aren't parsed nicely, see https://github.com/baynezy/Html2Markdown/blob/690e1f6b9cbcba2333acfef68c05795d698040ad/src/Html2Markdown/Replacement/HtmlParser.cs
            // http://localhost:8080/api/Lucene.Net/Lucene.Net.Search.Spans.html
            // source: C:\Users\Shannon\Documents\_Projects\Lucene.Net\lucene-solr-releases-lucene-solr-4.8.0\lucene\core\src\java\org\apache\lucene\search\spans\package.html

            _replacers.Add(new CodeLinkReplacer());
            _replacers.Add(new RepoLinkReplacer());
            _replacers.Add(new DocTypeReplacer());
            _replacers.Add(new ExtraHtmlElementReplacer());
            _replacers.Add(new NamedAnchorLinkReplacer());
            _replacers.Add(new DivWrapperReplacer());

            foreach (var replacer in additionalReplacers)
            {
                _replacers.Add(replacer);
            }
        }