mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-08 13:38:41 +00:00
feat(apps/html2markdown): katex support
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3c3ec65551
commit
22655baad8
@ -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() {
|
$(document).ready(function() {
|
||||||
$('#html').on('input', function() {
|
$('#html').on('input', function() {
|
||||||
$('#markdown').val(turndownService.turndown($('#html').val()));
|
$('#markdown').val(turndownService.turndown($('#html').val()));
|
||||||
|
Loading…
Reference in New Issue
Block a user