mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
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:
committed by
GitHub
parent
15cefc664a
commit
c2e219b446
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user