From 31a798ff212c21c0713fbb0948f0e3dba4daa475 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Fri, 13 Oct 2023 13:42:18 -0400 Subject: [PATCH] Fix multiple $math$ chunks connected only by punctuation (fix #636) --- CHANGELOG.md | 5 +++++ lib/formats.coffee | 3 +++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf8a9a3..a0aca81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ To see every change with descriptions aimed at developers, see As a continuously updated web app, Coauthor uses dates instead of version numbers. +## 2023-10-13 + +* Fix multiple \$math\$ chunks connected only by punctuation + [[#636](https://github.com/edemaine/coauthor/issues/636)] + ## 2023-10-12 * Superusers can now start private threads (e.g. for course staff discussion) diff --git a/lib/formats.coffee b/lib/formats.coffee index dc493bb..64f60c7 100644 --- a/lib/formats.coffee +++ b/lib/formats.coffee @@ -572,12 +572,14 @@ formats = [text, ticks] = preprocessMarkdownTicks text ## Support what we can of LaTeX before doing Markdown conversion. [text, math] = latex2htmlLight text, me + #console.log text, math ## Put Markdown verbatims back in. text = putTicksBack text, ticks if title ## use "single-line" version of Markdown text = markdownInline text else text = markdown text + #console.log 'markdown', text ## Convert
    output from Markdown to CSS-compatible reset. text = text.replace /
      /ig, (match, start) -> """
        """ @@ -761,6 +763,7 @@ postprocessKaTeX = (text, math, initialBold) -> !MATH(\d+)ENDMATH! ([,.!?:;'"\-)\]}]*) # right puncutation to pull into math mode (?! -?> ) # prevent accidentally grabbing some of --> (end of HTML comment) + (?! MATH ) # prevent accidentally grabbing part of !MATH | ## Detect math within bold mode: ]*)> |