mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 14:19:59 +00:00
Handle softbreaks properly with commonmark, fixes #100
This commit is contained in:
parent
88311e0551
commit
40d7540058
|
@ -106,8 +106,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
var targetEl = markdownEditor.querySelector(targetSelector);
|
||||
|
||||
var reader = new commonmark.Parser({safe: true});
|
||||
var writer = new commonmark.HtmlRenderer({safe: true});
|
||||
writer.softbreak = '<br />';
|
||||
var writer = new commonmark.HtmlRenderer({safe: true, softbreak: '<br />'});
|
||||
|
||||
previewTabEl.addEventListener('click', function () {
|
||||
var parsed = reader.parse(sourceSelector.value.trim());
|
||||
|
|
|
@ -123,8 +123,7 @@
|
|||
var target = document.getElementById('torrent-description');
|
||||
var text = target.innerHTML;
|
||||
var reader = new commonmark.Parser({safe: true});
|
||||
var writer = new commonmark.HtmlRenderer({safe: true});
|
||||
writer.softbreak = '<br />';
|
||||
var writer = new commonmark.HtmlRenderer({safe: true, softbreak: '<br />'});
|
||||
var parsed = reader.parse(text.trim());
|
||||
target.innerHTML = writer.render(parsed);
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue