Change markdown files to treat soft endings as hard (#11271)

This commit is contained in:
Clint Rutkas
2021-05-18 05:07:55 -07:00
committed by GitHub
parent f29b8dc50c
commit c948c1fca8
2 changed files with 8 additions and 0 deletions

View File

@@ -676,6 +676,7 @@ hangeul
hanja hanja
hanselman hanselman
hardcoded hardcoded
Hardlines
HARDWAREINPUT HARDWAREINPUT
hashcode hashcode
hbitmap hbitmap
@@ -1809,6 +1810,7 @@ sln
SMALLICON SMALLICON
SMTO SMTO
snd snd
softline
somil somil
Soref Soref
SORTDOWN SORTDOWN

View File

@@ -65,9 +65,15 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
/// </summary> /// </summary>
public MarkdownPreviewHandlerControl() public MarkdownPreviewHandlerControl()
{ {
// if you have a string with double space, some people view it as a new line.
// while this is against spec, even GH supports this. Technically looks like GH just trims whitespace
// https://github.com/microsoft/PowerToys/issues/10354
var softlineBreak = new Markdig.Extensions.Hardlines.SoftlineBreakAsHardlineExtension();
_extension = new HTMLParsingExtension(ImagesBlockedCallBack); _extension = new HTMLParsingExtension(ImagesBlockedCallBack);
_pipelineBuilder = new MarkdownPipelineBuilder().UseAdvancedExtensions().UseEmojiAndSmiley().UseYamlFrontMatter().UseMathematics(); _pipelineBuilder = new MarkdownPipelineBuilder().UseAdvancedExtensions().UseEmojiAndSmiley().UseYamlFrontMatter().UseMathematics();
_pipelineBuilder.Extensions.Add(_extension); _pipelineBuilder.Extensions.Add(_extension);
_pipelineBuilder.Extensions.Add(softlineBreak);
} }
/// <summary> /// <summary>