Skip to content

Commit 2d1b83b

Browse files
authored
Markdown: Fix rendering of '$' in non-math view mode (PR #2485 closes #2085 #2236)
1 parent 665925d commit 2d1b83b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

app/src/main/java/net/gsantner/markor/format/markdown/MarkdownTextConverter.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,13 @@ public String convertMarkup(String markup, Context context, boolean lightMode, b
267267
}
268268

269269
// Enable Math / KaTex
270-
if (_appSettings.isMarkdownMathEnabled() && markup.contains("$")) {
271-
head += HTML_KATEX_INCLUDE;
272-
head += CSS_KATEX;
270+
if (markup.contains("$")) {
271+
if (_appSettings.isMarkdownMathEnabled()) {
272+
head += HTML_KATEX_INCLUDE;
273+
head += CSS_KATEX;
274+
} else {
275+
markup = markup.replace("$", "\\$");
276+
}
273277
}
274278

275279
// Enable View (block) code syntax highlighting

0 commit comments

Comments
 (0)