From c948c1fca8eccc7adec01684752074aba13828ab Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Tue, 18 May 2021 05:07:55 -0700 Subject: [PATCH] Change markdown files to treat soft endings as hard (#11271) --- .github/actions/spell-check/expect.txt | 2 ++ .../MarkdownPreviewHandler/MarkdownPreviewHandlerControl.cs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 80feb8280a..8a3baef843 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -676,6 +676,7 @@ hangeul hanja hanselman hardcoded +Hardlines HARDWAREINPUT hashcode hbitmap @@ -1809,6 +1810,7 @@ sln SMALLICON SMTO snd +softline somil Soref SORTDOWN diff --git a/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandlerControl.cs b/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandlerControl.cs index fe6b6f3310..434b8e7ad3 100644 --- a/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandlerControl.cs +++ b/src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandlerControl.cs @@ -65,9 +65,15 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown /// 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); + _pipelineBuilder = new MarkdownPipelineBuilder().UseAdvancedExtensions().UseEmojiAndSmiley().UseYamlFrontMatter().UseMathematics(); _pipelineBuilder.Extensions.Add(_extension); + _pipelineBuilder.Extensions.Add(softlineBreak); } ///