Skip to content

Commit

Permalink
Work around jekyll's handling of ".." in anchors
Browse files Browse the repository at this point in the history
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
<h2 id="codeusesarifcode-and-codeactcode"><code>use_sarif</code> and <code>act</code></h2>
<h2 id="adjusting-codesarifjsoncode">Adjusting <code>sarif.json</code></h2>
````
  • Loading branch information
jsoref committed Nov 17, 2024
1 parent da6ae52 commit 3e05876
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/actions/spelling/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3e05876

Please sign in to comment.