[pkgsite] static: drop marked dep, extract code fences with a regex

0 views
Skip to first unread message

Hyang-Ah Hana Kim (Gerrit)

unread,
May 11, 2026, 11:51:14 AM (12 hours ago) May 11
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Jonathan Amsterdam, Ethan Lee, kokoro, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com

Hyang-Ah Hana Kim submitted the change

Change information

Commit message:
static: drop marked dep, extract code fences with a regex

Replace static/markdown.ts's use of marked with a small regex that
concatenates the contents of all fenced code blocks (```...```) in the
input file. This matches the original behavior, where the only marked
renderer override was code: ({text}) => text -- the test harness only
ever needed the inner HTML of the fenced blocks, not the surrounding
markdown.

Motivation: marked v5+ is ESM-only, so updating it past 4.0.10 would
require migrating the jest test setup to ESM mode (extensionsToTreatAsEsm,
useESM, --experimental-vm-modules, "import { jest } from '@jest/globals'"
in every test file, an import.meta.url-derived __dirname polyfill, etc.).
That is a much larger surgery than the trivial markdown extraction
warrants. Removing the dep entirely is simpler and leaves no security
surface from an unmaintained 4.x line.

@types/marked is also no longer needed.
Change-Id: I63a569dfd0c091974d7beacbf5e6d1c720736910
kokoro-CI: kokoro <noreply...@google.com>
Reviewed-by: Jonathan Amsterdam <j...@google.com>
Files:
  • M package-lock.json
  • M package.json
  • A static/markdown.test.ts
  • M static/markdown.ts
Change size: M
Delta: 4 files changed, 95 insertions(+), 36 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: pkgsite
Gerrit-Branch: master
Gerrit-Change-Id: I63a569dfd0c091974d7beacbf5e6d1c720736910
Gerrit-Change-Number: 776542
Gerrit-PatchSet: 3
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages