diff --git a/web/app/controllers/apps/html2markdown.php b/web/app/controllers/apps/html2markdown.php
index d0c02f7..e3b0004 100644
--- a/web/app/controllers/apps/html2markdown.php
+++ b/web/app/controllers/apps/html2markdown.php
@@ -93,6 +93,33 @@
}
});
+ turndownService.addRule('katexInline', {
+ filter: function(node) {
+ return node.nodeName === 'SPAN' && node.getAttribute('class') === 'katex';
+ },
+
+ escapeContent: function() {
+ return false;
+ },
+
+ replacement: function(content, node, options) {
+ return '$' + $('.katex-mathml annotation[encoding="application/x-tex"]', node).html() + '$';
+ }
+ });
+ turndownService.addRule('katexInline', {
+ filter: function(node) {
+ return node.nodeName === 'SPAN' && node.getAttribute('class') === 'katex-display';
+ },
+
+ escapeContent: function() {
+ return false;
+ },
+
+ replacement: function(content, node, options) {
+ return '$$\n' + $('.katex-mathml annotation[encoding="application/x-tex"]', node).html() + '\n$$';
+ }
+ });
+
$(document).ready(function() {
$('#html').on('input', function() {
$('#markdown').val(turndownService.turndown($('#html').val()));