Skip to content

Commit

Permalink
Fix markdown escape issues (#21)
Browse files Browse the repository at this point in the history
* - update deps

- don't try to escape MD in factset
- handle *` escape sequences in _nomd

* fix deps

* debugging...

* still debugging

* escape `
  • Loading branch information
MaceWindu authored Jan 6, 2025
1 parent 052d3ae commit 82d19fe
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
26 changes: 16 additions & 10 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
<Project>
<ItemGroup>
<!--main-->
<PackageVersion Include="Seq.Apps" Version="2023.4.0" />
<PackageVersion Include="AdaptiveCards.Templating" Version="2.0.2" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="PolySharp" Version="1.14.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="AdaptiveCards.Templating" Version="2.0.4" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
<PackageVersion Include="PolySharp" Version="1.15.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<!--dependency pinning as Seq uses v8 currently-->
<PackageVersion Include="System.Text.Json" Version="8.0.5" />

<!--shared-->
<PackageVersion Include="Lindhart.Analyser.MissingAwaitWarning" Version="3.1.0-beta" />
<PackageVersion Include="NUnit.Analyzers" Version="4.2.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0-preview.24318.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0-beta1.24318.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0-preview.24527.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0-beta1.24527.2" />

<!--tests-->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageVersion Include="NUnit" Version="4.3.2" />
<PackageVersion Include="NUnit.Analyzers" Version="4.5.0" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions ci/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ variables:
- name: build_configuration
value: Release
- name: assemblyVersion
value: 2.2.0
value: 2.3.0
- name: packageVersion
value: 2.2.0
value: 2.3.0
- name: nugetDevVersion
value: 2.2.1
value: 2.3.1

trigger:
- master
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"facts": [
{
"$data": "${indicesAndValues(Properties)}",
"title": "**${_nomd(index)}**",
"value": "${_jsonPrettify(if(exists(value), _nomd(value), ''))}"
"title": "**${index}**",
"value": "${_jsonPrettify(if(exists(value), value, ''))}"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<PackageReference Include="Seq.Apps" />
<PackageReference Include="AdaptiveCards.Templating" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Text.Json" />

<PackageReference Include="PolySharp" />
<PackageReference Include="Microsoft.SourceLink.GitHub">
Expand Down
7 changes: 6 additions & 1 deletion src/Seq.App.Teams.AdaptiveCard/TeamsApp.CustomFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ public static void RegisterCustomFunctions()
// character, used in markdown
return strValue
.Replace("_", "\\_")
.Replace("**", "\\**")
// escape * instead of ** as MS implementation works not like documented
//.Replace("**", "\\**")
.Replace("*", "\\*")
.Replace("- ", "\\- ")
// for D. we should escape dot
.Replace(". ", "\\. ")
.Replace("](", "\\](")
// not documented and not formatted, but disappears from text if not escaped
.Replace("`", "\\`")
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ internal sealed class CustomFunctionsTests
[TestCase(null, "\"${val}\"")]
[TestCase(123, "123")]
[TestCase("_italic_", "\"\\\\_italic\\\\_\"")]
[TestCase("**bold**", "\"\\\\**bold\\\\**\"")]
[TestCase("`magic`", "\"\\\\\\u0060magic\\\\\\u0060\"")]
[TestCase("*bold too*", "\"\\\\*bold too\\\\*\"")]
[TestCase("**bold**", "\"\\\\*\\\\*bold\\\\*\\\\*\"")]
[TestCase("*italic too*", "\"\\\\*italic too\\\\*\"")]
[TestCase("- list\r\n- item", "\"\\\\- list\\r\\n\\\\- item\"")]
[TestCase("1. list\r\n2. item", "\"1\\\\. list\\r\\n2\\\\. item\"")]
[TestCase("[link](http://local.host)", "\"[link\\\\](http://local.host)\"")]
Expand Down

0 comments on commit 82d19fe

Please sign in to comment.