Display infobar for blocked relative image path (#1695)

* Updated Parsing extension to show infobar when relative URL isblocked and updated corresponding tests

* Updated Controller to display infobar when html img tag is embedded in markdown
This commit is contained in:
Divyansh Srivastava
2020-03-26 15:17:28 -07:00
committed by GitHub
parent 15cefc664a
commit c2e219b446
6 changed files with 114 additions and 132 deletions

View File

@@ -8,6 +8,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Common;
using Markdig;
@@ -83,6 +84,12 @@ namespace MarkdownPreviewHandler
string fileText = File.ReadAllText(filePath);
this.extension.BaseUrl = Path.GetDirectoryName(filePath);
Regex rgx = new Regex(@"<[ ]*img.*>");
if (rgx.IsMatch(fileText))
{
this.infoBarDisplayed = true;
}
MarkdownPipeline pipeline = this.pipelineBuilder.Build();
string parsedMarkdown = Markdown.ToHtml(fileText, pipeline);
sb.AppendFormat("{0}{1}{2}", this.htmlHeader, parsedMarkdown, this.htmlFooter);