Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathJax changes to support MathJax 3 #81

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions markdown/markdown.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ Markdown Extra} and

@item{Support for math-jax expressions --- inline within @litchar{\\(}
and @litchar{\\)} delimiters and display within @litchar{\\[} and
@litchar{\\]} delimiters --- resulting in @tt{script} elements with
@tt{type=math/tex}.}
@litchar{\\]} delimiters --- resulting in eqivalent markup in the output.}

]}

Expand Down
6 changes: 2 additions & 4 deletions markdown/parse.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -640,14 +640,12 @@
(define $math-jax-inline
(try (pdo (string "\\\\(")
(xs <- (many1Till $anyChar (try (string "\\\\)"))))
(return `(script ([type "math/tex"])
,(list->string xs))))))
(return (string-append "\\(" (list->string xs) "\\)")))))

(define $math-jax-display
(try (pdo (string "\\\\[")
(xs <- (many1Till $anyChar (try (string "\\\\]"))))
(return `(script ([type "math/tex; mode=display"])
,(list->string xs))))))
(return (string-append "\\[" (list->string xs) "\\]")))))

(define $math-jax
(<or> $math-jax-inline
Expand Down
6 changes: 2 additions & 4 deletions markdown/test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -933,11 +933,9 @@
(!HTML-COMMENT () " more")))))
;; https://github.com/greghendershott/markdown/issues/52
(check-md "\\\\(ax^2 + bx + c = 0\\\\)"
'((p () (script ((type "math/tex"))
"ax^2 + bx + c = 0"))))
'((p () "\\(ax^2 + bx + c = 0\\)")))
(check-md "\\\\[ax^2 + bx + c = 0\\\\]"
'((p () (script ((type "math/tex; mode=display"))
"ax^2 + bx + c = 0"))))
'((p () "\\[ax^2 + bx + c = 0\\]")))
;; but single \ still escapes as usual and the contents are still
;; parsed as markdown:
(check-md "\\(some *italic* text\\)"
Expand Down
Loading