From 90deba29d1a81bb2fbd033299adbccc3af6d01ac Mon Sep 17 00:00:00 2001 From: jdarcyryan Date: Sun, 12 Apr 2026 19:06:25 +0100 Subject: [PATCH] favicon + release formatting --- .github/workflows/pages.yml | 91 +++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index a33952d..ce8ac2e 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -46,31 +46,19 @@ jobs: REPO: ${{ github.repository }} run: | echo "Repository is private — removing existing Pages deployments" - - # List all deployments in the github-pages environment DEPLOYMENTS=$(gh api "repos/${REPO}/deployments?environment=github-pages&per_page=100" --jq '.[].id' 2>/dev/null || true) - if [ -z "$DEPLOYMENTS" ]; then echo "No existing Pages deployments found" exit 0 fi - - # Mark each deployment as inactive, then delete it for ID in $DEPLOYMENTS; do echo "Deactivating deployment ${ID}..." - gh api \ - --method POST \ - -H "Accept: application/vnd.github+json" \ - "repos/${REPO}/deployments/${ID}/statuses" \ - -f state=inactive 2>/dev/null || true - + gh api --method POST -H "Accept: application/vnd.github+json" \ + "repos/${REPO}/deployments/${ID}/statuses" -f state=inactive 2>/dev/null || true echo "Deleting deployment ${ID}..." - gh api \ - --method DELETE \ - -H "Accept: application/vnd.github+json" \ + gh api --method DELETE -H "Accept: application/vnd.github+json" \ "repos/${REPO}/deployments/${ID}" 2>/dev/null || true done - echo "All Pages deployments removed" # ── Build (only if public) ────────────────────────────────────── @@ -98,13 +86,8 @@ jobs: STAGE="_site_source" echo "::group::Staging allowed files" - - # ── Stage ONLY allowed files into a clean directory ─────────── - # Whitelist: *.md files + LICENSE + LICENSE.txt - # Everything else is excluded from the site. mkdir -p "${STAGE}" - # Copy all .md files preserving directory structure find . -name '*.md' \ -not -path './.git/*' \ -not -path "./${STAGE}/*" \ @@ -114,19 +97,16 @@ jobs: cp "$f" "$dest" done - # Copy LICENSE files (plain text) for lf in LICENSE LICENSE.txt; do [ -f "$lf" ] && cp "$lf" "${STAGE}/" done - # Remove any .gitkeep files that got copied find "${STAGE}" -name '.gitkeep' -delete echo "Staged files:" find "${STAGE}" -type f | sort echo "::endgroup::" - # ── Everything below operates inside the staging dir ────────── cd "${STAGE}" echo "::group::Generating Jekyll config and layout" @@ -156,8 +136,10 @@ jobs: {{ page.title | default: site.title }} + + @@ -241,6 +240,15 @@ jobs:
{{ content }}
+ + + + + + + + + LAYOUTEOF @@ -312,6 +320,7 @@ jobs: (async function() { var c = document.getElementById('releases-container'); var repo = c.getAttribute('data-repo'); + var SHELL = {'bash':1,'sh':1,'shell':1,'console':1,'zsh':1,'terminal':1}; try { var res = await fetch('https://api.github.com/repos/' + repo + '/releases'); if (!res.ok) throw new Error(res.status); @@ -334,7 +343,7 @@ jobs: return pre + '@' + user + ''; }) .replace(/\*\*([^*]+)\*\*/g, '$1') - .replace(/(?$1'); + .replace(/(?$1'); s = s.replace(/\x00CODE(\d+)\x00/g, function(m, idx) { return '' + codes[parseInt(idx)] + ''; }); @@ -355,11 +364,14 @@ jobs: if (cb) { if (inList) { html += ''; inList = false; } var lang = cb[1].trim(); - var code = ''; + var escaped = ''; i++; - while (i < lines.length && !lines[i].match(/^```/)) { code += lines[i] + '\n'; i++; } - var langLabel = lang ? '
' + lang + '
' : ''; - html += '
' + langLabel + '
' + code.replace(//g,'>') + '
'; + while (i < lines.length && !lines[i].match(/^```/)) { escaped += lines[i] + '\n'; i++; } + escaped = escaped.replace(//g,'>'); + var isShell = !lang || SHELL[lang.toLowerCase()]; + var langLabel = (!isShell && lang) ? '
' + lang + '
' : ''; + var langClass = lang ? ' class="language-' + lang + '"' : ''; + html += '
' + langLabel + '' + escaped + '
'; } else if (h2) { if (inList) { html += ''; inList = false; } html += '

' + inline(h2[1]) + '

'; @@ -386,7 +398,6 @@ jobs: var latest = i === 0 ? 'latest' : ''; var openAttr = i === 0 ? ' open' : ''; - // Commit SHA var sha = r.target_commitish || ''; var shortSha = sha.substring(0, 7); var shaHtml = ''; @@ -396,7 +407,6 @@ jobs: + ''; } - // Assets var assets = ''; if (r.assets.length) { var hashMap = {}; @@ -415,7 +425,7 @@ jobs: var srcTar = 'https://github.com/' + repo + '/archive/refs/tags/' + r.tag_name + '.tar.gz'; var totalAssets = mainAssets.length + 2; - assets = '
Assets (' + totalAssets + ')'; + assets = '
Assets (' + totalAssets + ')'; for (var j = 0; j < mainAssets.length; j++) { var a = mainAssets[j]; var hash = hashMap[a.name]; @@ -432,6 +442,9 @@ jobs: return '
' + r.tag_name + '' + latest + '' + d + '
' + md(r.body) + assets + shaHtml + '
'; }).join(''); + + // Trigger Prism highlighting on dynamically inserted code + if (typeof Prism !== 'undefined') Prism.highlightAll(); } catch(e) { c.innerHTML = '

Unable to load releases. Visit GitHub directly.

'; }