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

Revert escaping dollar symbol #193

Merged
merged 3 commits into from
Jun 12, 2024
Merged

Revert escaping dollar symbol #193

merged 3 commits into from
Jun 12, 2024

Conversation

rikhuijzer
Copy link
Owner

@rikhuijzer rikhuijzer commented Jun 11, 2024

Franklin automatically converts $x$ to \(x\) and Pluto to <span> etc, so the best option is to avoid convert $x$ via KaTeX in Javascript post processing. Then, dollars do not have to be escaped. This solves the problem where it is actually not so straightforward in Javascript to un-escape dollar symbols after running KaTeX.

EDIT: Maybe better would be for PlutoStaticHTML.jl to not escape dollar symbols, but instead to convert inline math dollar symbols to \( and \) like Franklin.jl does. Pluto.jl by defaults converts inline math such as $r$ to

<span class="tex">$r$</span>

(without newlines; these are added here for readability.)

@rikhuijzer rikhuijzer merged commit 26bf861 into main Jun 12, 2024
3 checks passed
@rikhuijzer rikhuijzer deleted the rh/revert-dollar branch June 12, 2024 06:33
@rikhuijzer rikhuijzer mentioned this pull request Jun 12, 2024
2 tasks
rikhuijzer added a commit that referenced this pull request Jun 12, 2024
Inline math via dollar symbols can conflict with using dollar symbols
for representing dollars. Fixing this by escaping dollars is not an
option since it is hard to run KaTeX and unescape dollars in Javascript
(see also #193). So
instead of fixing the dollars for representing currency, this patch
fixes the dollar for representing inline math by converting the dollars
to `\(` and `\)`. This is also how Franklin.jl handles it. In other
words, Franklin.jl also converts dollar symbols for inline math to `\(`
and `\)`.

## Tasks

- [x] Add test to verify that Pluto.jl returns `<span
class="tex">$x$</span>` for `$x$`.
- [x] Verify that Documenter.jl also interprets `\(` and `\)` as inline
math.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant