Skip to content

Commit

Permalink
fix: Don't use replaceAll (older browsers fail)
Browse files Browse the repository at this point in the history
  • Loading branch information
lo5 committed Jun 23, 2022
1 parent 805ea83 commit 2a7618c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/src/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const micromarkReplacements: Dict<S> = {

export const
highlight = (html: S) => html
.replaceAll(/<code class="language-(.+?)">(.+?)<\/code>/gms, (_, language, code) => {
.replace(/<code class="language-(.+?)">(.+?)<\/code>/gms, (_, language, code) => {
const src = hljs.highlight(revertMicromarkEncodings(code), { language }).value
return `<code>${src}</code>`
}),
Expand All @@ -79,7 +79,7 @@ export const
// Exclude hashbangs #!, which act as context switches.
// Exclude footnote references.
// We need the links to be rendered as such, but not affect the address bar.
.replaceAll(/href="#([^!].+?)"/g, (all, ref) => {
.replace(/href="#([^!].+?)"/g, (all, ref) => {
if (isFootnoteLink(ref)) return all
hasLinks = true
return `data-jump="${ref}" href`
Expand Down

0 comments on commit 2a7618c

Please sign in to comment.