From 3bd2f1c715ad71f115ad493939bb4d65e2d3420f Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Thu, 2 Oct 2025 12:32:26 -0700 Subject: [PATCH 1/4] Add link highlighting for GitHub-style hashtags. --- packages/overtype | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/overtype b/packages/overtype index ff2c832..f5149dc 160000 --- a/packages/overtype +++ b/packages/overtype @@ -1 +1 @@ -Subproject commit ff2c8325c9d4e968098c6c46e6b0f5c877e8ab80 +Subproject commit f5149dce2125e1f3749961eaa4f12b75af648946 From 93467fab97cafe8d2222404b8cd7002c89debdb0 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Thu, 2 Oct 2025 13:37:33 -0700 Subject: [PATCH 2/4] Add autolink. --- packages/overtype | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/overtype b/packages/overtype index f5149dc..d276bef 160000 --- a/packages/overtype +++ b/packages/overtype @@ -1 +1 @@ -Subproject commit f5149dce2125e1f3749961eaa4f12b75af648946 +Subproject commit d276bef0f57857ef981279eaf73f5f1510c69c46 From 43aa7b2a280257a518e09463146610104949394e Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Thu, 2 Oct 2025 14:16:51 -0700 Subject: [PATCH 3/4] Add highlighting for html tags (and fix html tags inside code blocks). --- packages/overtype | 2 +- src/lib/enhancers/github/github-common.ts | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/overtype b/packages/overtype index d276bef..3e48814 160000 --- a/packages/overtype +++ b/packages/overtype @@ -1 +1 @@ -Subproject commit d276bef0f57857ef981279eaf73f5f1510c69c46 +Subproject commit 3e48814e9993e842f541dfe1186fb5b32378e536 diff --git a/src/lib/enhancers/github/github-common.ts b/src/lib/enhancers/github/github-common.ts index 796f70c..38b49b7 100644 --- a/src/lib/enhancers/github/github-common.ts +++ b/src/lib/enhancers/github/github-common.ts @@ -36,16 +36,28 @@ export function prepareGitHubHighlighter() { }) } +function escapeHtml(text: string): string { + const map: Record = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + } + return text.replace(/[&<>"']/g, (m) => map[m]) +} + function githubHighlighter(code: string, language?: string) { try { if (language && hljs.getLanguage(language)) { const result = hljs.highlight(code, { language }) return result.value } else { - return code + // No language specified - escape HTML to prevent tags from being interpreted + return escapeHtml(code) } } catch (error) { console.warn("highlight.js highlighting failed:", error) - return code + return escapeHtml(code) } } From 68e60ff19fc59018cbf762b5ffc703468b6707d4 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Thu, 2 Oct 2025 14:22:16 -0700 Subject: [PATCH 4/4] fix typechecking --- src/lib/enhancers/github/github-common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/enhancers/github/github-common.ts b/src/lib/enhancers/github/github-common.ts index 38b49b7..09f57ff 100644 --- a/src/lib/enhancers/github/github-common.ts +++ b/src/lib/enhancers/github/github-common.ts @@ -44,7 +44,7 @@ function escapeHtml(text: string): string { '"': """, "'": "'", } - return text.replace(/[&<>"']/g, (m) => map[m]) + return text.replace(/[&<>"']/g, (m) => map[m]!) } function githubHighlighter(code: string, language?: string) {