From 3e05876b368c0136927b2e82ec12789b243bfece Mon Sep 17 00:00:00 2001
From: Josh Soref <2119212+jsoref@users.noreply.github.com>
Date: Tue, 12 Nov 2024 21:23:50 -0500
Subject: [PATCH] Work around jekyll's handling of "`..`" in anchors
There's an annoying quirk in jekyll's handling of:
```markdown
# `use_sarif` and `act`
# Adjusting `sarif.json`
```
Where it replaces the backticks with the literal string 'code' resulting
in anchors like:
```html
use_sarif
and act
Adjusting sarif.json
````
---
.github/actions/spelling/patterns.txt | 3 +++
.github/workflows/jekyll-gh-pages.yml | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt
index 35a87d3..6bb1080 100644
--- a/.github/actions/spelling/patterns.txt
+++ b/.github/actions/spelling/patterns.txt
@@ -163,6 +163,9 @@ x-served-by: \S+
# Candidate pattern
Line matches candidate pattern `.*` \(candidate-pattern\)
+# jekyll bug
+".*?code.*?code.*?"
+
# Questionably acceptable forms of `in to`
# Personally, I prefer `log into`, but people object
# https://www.tprteaching.com/log-into-log-in-to-login/
diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml
index 5eaef46..0a18479 100644
--- a/.github/workflows/jekyll-gh-pages.yml
+++ b/.github/workflows/jekyll-gh-pages.yml
@@ -27,6 +27,12 @@ jobs:
with:
source: ./
destination: ./_site
+ - name: Fix code anchors (# `something` or another) or (# thing or `thing`) which are unfortunately encoded as (id="codesomethingcode-or-another") or (id="thing-or-codethingcode")
+ working-directory: ./_site
+ shell: bash
+ run: |
+ : 'Fix anchors that poorly encoded "`foo`" as "codefoocode"'
+ sudo perl -pi -e 'while (s/(id="[^"]*)code([^"]+)code/$1$2/g) {};' *.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3