Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes link urls when multiple rounded brackets are used #417

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Public/New-HTMLText.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ function New-HTMLText {
if ($FindMe) {
foreach ($find in $FindMe) {
$LinkName = ([regex]::Match($Find.value, "[^\[]+(?=\])")).Value
$LinkURL = ([regex]::Match($Find.value, "(?<=\().+(?=\))")).Value
$res = [regex]::Matches($Find.value, "\(([^)]+)\)")
$LinkURL = $res.captures.groups[$res.captures.groups.count-1].Value
$Link = New-HTMLAnchor -HrefLink $LinkURL -Text $LinkName
$Text[$i] = $Text[$i].Replace($find.value, $Link)
}
Expand Down Expand Up @@ -333,4 +334,4 @@ function New-HTMLText {
}

Register-ArgumentCompleter -CommandName New-HTMLText -ParameterName Color -ScriptBlock $Script:ScriptBlockColors
Register-ArgumentCompleter -CommandName New-HTMLText -ParameterName BackgroundColor -ScriptBlock $Script:ScriptBlockColors
Register-ArgumentCompleter -CommandName New-HTMLText -ParameterName BackgroundColor -ScriptBlock $Script:ScriptBlockColors