From e29129efe58ef9e1763217cb36215d43c98022f1 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Fri, 7 Aug 2020 10:32:58 +0200 Subject: [PATCH] Update --- Public/ConvertFrom-HTMLtoMarkdown.ps1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Public/ConvertFrom-HTMLtoMarkdown.ps1 b/Public/ConvertFrom-HTMLtoMarkdown.ps1 index 1a17de9..591cd95 100644 --- a/Public/ConvertFrom-HTMLtoMarkdown.ps1 +++ b/Public/ConvertFrom-HTMLtoMarkdown.ps1 @@ -1,5 +1,18 @@ function ConvertFrom-HTMLToMarkdown { + [cmdletBinding()] param( - + [string] $Path, + [string] $DestinationPath, + [ReverseMarkdown.Config+UnknownTagsOption] $UnknownTags = [ReverseMarkdown.Config+UnknownTagsOption]::Drop, + [switch] $GithubFlavored ) + if ($Path -and (Test-Path -Path $Path)) { + $Content = Get-Content -Path $Path + + $Converter = [ReverseMarkdown.Converter]::new() + $Converter.Config.UnknownTags = $UnknownTags + $Converter.Config.GithubFlavored = $GithubFlavored.IsPresent + $ContentMD = $Converter.Convert($Content) + $ContentMD | Out-File -FilePath $DestinationPath + } } \ No newline at end of file