reversemarkdown-net icon indicating copy to clipboard operation
reversemarkdown-net copied to clipboard

Blank lines being added on things that are getting dropped/bypassed

Open PrzemyslawKlys opened this issue 3 years ago • 3 comments

    $Splat = @{
        #Content                  = $BlogContent.Content
        Path                     = $FilePath
        DestinationPath          = "$PSScriptRoot\OutputBlogs\$($FileName).md"
        UnknownTags              = 'Bypass'
        GithubFlavored           = $true
        RemoveComments           = $true
        SmartHrefHandling        = $true
        RulesBefore              = $RulesBefore
        RulesAfter               = $RulesAfter
        DefaultCodeBlockLanguage = 'powershell'
    }

There's a lot of blank lines that stay after your library goes thru the HTML. It seems that every time some tags are removed those are replaced by blank lines? Could it be those are totally skipped maybe?

image

PrzemyslawKlys avatar Mar 28 '21 14:03 PrzemyslawKlys

I discovered that as well, but ende up cleaning the result with simple postprocessing.

result = result.Replace("\n\n", "\n");
result = result.Replace("\r\n\r\n", "\r\n");
result = result.Replace("\r\n\r\n", "\r\n");
if (result.StartsWith("\r\n"))
{
	result = result.TrimStart('\r', '\n');
}
return result;

so maybe we can have something like this by default?

mos379 avatar Jan 27 '22 09:01 mos379

I discovered that as well, but ende up cleaning the result with simple postprocessing.

result = result.Replace("\n\n", "\n");
result = result.Replace("\r\n\r\n", "\r\n");
result = result.Replace("\r\n\r\n", "\r\n");
if (result.StartsWith("\r\n"))
{
	result = result.TrimStart('\r', '\n');
}
return result;

so maybe we can have something like this by default?

I have added some cleanup and processing of newlines in 3.21.0, please take latest and check if it has become better. Possibly you don't need to do this step going forward.

mysticmind avatar Jan 27 '22 13:01 mysticmind

seems to be a bit better. need to check more in detail

mos379 avatar Jan 28 '22 14:01 mos379

Closing this, please file a new issue if you see any further issues.

mysticmind avatar Aug 31 '22 17:08 mysticmind