Skip to content

Commit

Permalink
Fix multiple $math$ chunks connected only by punctuation (fix #636)
Browse files Browse the repository at this point in the history
  • Loading branch information
edemaine committed Oct 13, 2023
1 parent a77b57a commit 31a798f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions lib/formats.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ol start=...> output from Markdown to CSS-compatible reset.
text = text.replace /<ol start="([\d+])">/ig, (match, start) ->
"""<ol style="counter-reset: enum #{-1 + parseInt start}">"""
Expand Down Expand Up @@ -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:
<span([^<>]*)> |
<b\b |
Expand Down

0 comments on commit 31a798f

Please sign in to comment.