public static string Process(string markdown)
        {
            string result = markdown;

            //Add line breaks to Markdown text
            //result = CleanFigureMarkdown(result);
            result = ReplaceHtmlLineBreaks(result);
            result = FixMultilineFigures(result);

            //Fix images and figures
            result = RemoveExternalLinkImages(result);
            result = MarkdownImages.RemoveAltIfFilename(result);
            //result = MarkdownImages.FixFigures(result);

            //Tidy up Markdown
            result = result.Replace("<this is=\"\" as=\"\" per=\"\" the=\"\" rule=\"\"></this>", "< This is as per the rule ");
            result = result.Replace("<this email=\"\" was=\"\" sent=\"\" as=\"\" per=\"\"></this>", "< This email was sent as per ");

            result = HtmlHelper.RemoveNode(result, "dl", true);
            result = HtmlHelper.RemoveNode(result, "dt", true);
            result = HtmlHelper.RemoveNode(result, "dt", true);
            result = result.Replace("<br>", Environment.NewLine);

            //This endintro marker is for showing the rule blurb on the category page
            result = result.Replace("<excerpt class='endintro'></excerpt>", "<!--endintro-->");
            return(result);
        }
Ejemplo n.º 2
0
        public void ConvertImageWithFigureOnAnotherLineBold()
        {
            string test      = "![](image.png)\r\n**Figure: this is a caption**";
            string converted = MarkdownImages.RemoveAltIfNoFigure(test);

            converted = MarkdownImages.FixFigures(converted);

            converted.Should().Be("![this is a caption](image.png)");
        }
Ejemplo n.º 3
0
        public void ConvertImageWithFigureWithAltText()
        {
            string test      = "![image.png](image.png) Figure: this is a caption";
            string converted = MarkdownImages.RemoveAltIfNoFigure(test);

            converted = MarkdownImages.FixFigures(converted);

            converted.Should().Be("![this is a caption](image.png)");
        }
Ejemplo n.º 4
0
        public void ConvertImageWithoutFigureOrAltText()
        {
            string test      = "![](image.png)";
            string converted = MarkdownImages.RemoveAltIfNoFigure(test);

            converted = MarkdownImages.FixFigures(test);

            converted.Should().Be("![](image.png)");
        }
Ejemplo n.º 5
0
        public void ConvertImageWithLinkInFigure()
        {
            string test      = "![](image.png) Figure: this is a caption with a URL www.test.com";
            string converted = MarkdownImages.RemoveAltIfNoFigure(test);

            converted = MarkdownImages.FixFigures(converted);

            converted.Should().Be("![this is a caption with a URL www.test.com](image.png)");
        }
Ejemplo n.º 6
0
        public void ConvertImageWithLink()
        {
            string test      = "![](image.png)(www.test.com)";
            string converted = MarkdownImages.RemoveAltIfNoFigure(test);

            converted = MarkdownImages.FixFigures(converted);

            converted.Should().Be("![](image.png)(www.test.com)");
        }
Ejemplo n.º 7
0
        public void ConvertImageOkExample()
        {
            string test      = "![](image.png)\r\n**Figure: Ok example - this is a caption**";
            string converted = MarkdownImages.RemoveAltIfNoFigure(test);

            converted = MarkdownImages.FixFigures(converted);

            converted.Should().Be("[[okExample]]\r\n| ![this is a caption](image.png)");
        }