Skip to content

Commit

Permalink
Updated JavaScriptEngineSwitcher and highlight.js (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
daveaglick committed Jun 16, 2023
1 parent 625bd47 commit bff830b
Show file tree
Hide file tree
Showing 10 changed files with 12,784 additions and 15,838 deletions.
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.0.0-beta.71

- Updated JavaScriptEngineSwitcher.Core and JavaScriptEngineSwitcher.Jint.
- Updated `highlight.js` used in `Statiq.Highlight` (#269).

# 1.0.0-beta.70

- Updated Markdig to 0.31.0 to fix an upstream bug when using alt text on images (#267).
Expand Down
4 changes: 2 additions & 2 deletions src/core/Statiq.Core/Statiq.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<PackageTags>Statiq Static StaticContent StaticSite Blog BlogEngine</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.19.0" />
<PackageReference Include="JavaScriptEngineSwitcher.Jint" Version="3.1.0" />
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.21.0" />
<PackageReference Include="JavaScriptEngineSwitcher.Jint" Version="3.21.2" />
<PackageReference Include="JSPool" Version="2.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.18" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<PackageTags>Statiq Static StaticContent StaticSite Blog BlogEngine</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.19.0" />
<PackageReference Include="JavaScriptEngineSwitcher.Jint" Version="3.1.0" />
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.21.0" />
<PackageReference Include="JavaScriptEngineSwitcher.Jint" Version="3.21.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Statiq.Common\Statiq.Common.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/Statiq.Highlight/HighlightCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected override async Task<IEnumerable<IDocument>> ExecuteContextAsync(IExecu
{
if (string.IsNullOrWhiteSpace(_highlightJsFile))
{
x.ExecuteResource("highlight-all.js", typeof(HighlightCode));
x.ExecuteResource("highlight.js", typeof(HighlightCode));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/Statiq.Highlight/HighlightShortcode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public override ShortcodeResult Execute(KeyValuePair<string, string>[] args, str
}
else
{
x.ExecuteResource("highlight-all.js", typeof(Statiq.Highlight.HighlightCode));
x.ExecuteResource("highlight.js", typeof(Statiq.Highlight.HighlightCode));
}
}))
{
Expand Down
31 changes: 31 additions & 0 deletions src/extensions/Statiq.Highlight/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
To update `highlight.js` download a CDN copy from one of the standard CDNs listed at https://highlightjs.org/download/.

All usages of `console` should be commented out (I.e. `console.log()`, etc.).

It then needs a few tweaks to be compliant with the .NET regex engine:

- for python replace
```
const IDENT_RE = /[\p{XID_Start}_]\p{XID_Continue}*/u;
```
with
```
const IDENT_RE = /[a-zA-Z0-9_-]*/u;
```
Note that `\p{XID_Start}` and `\p{XID_Continue}` are unicode character classes that are not supported by the .NET regex engine (at least at the time this was written). Replacing them with the equivalent character classes works well enough, but does result in a loss of parsing fidelity. More information is at https://perldoc.perl.org/perlrecharclass#Unicode-Properties.
- for ada replace
```
var BAD_CHARS = '[]{}%#\'\"'
```
with
```
var BAD_CHARS = '{}%#\'\"'
```
- for lisp replace
```
var MEC_RE = '\\|[^]*?\\|';
```
with
```
var MEC_RE = '\\|[\S\s]*?\\|';
```
4 changes: 2 additions & 2 deletions src/extensions/Statiq.Highlight/Statiq.Highlight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<PackageTags>Statiq Static StaticContent StaticSite Blog BlogEngine Highlight.js</PackageTags>
</PropertyGroup>
<ItemGroup>
<None Remove="highlight-all.js" />
<None Remove="highlight.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="highlight-all.js" />
<EmbeddedResource Include="highlight.js" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\Statiq.Common\Statiq.Common.csproj" />
Expand Down

0 comments on commit bff830b

Please sign in to comment.