mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:30:00 +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 targetEl = markdownEditor.querySelector(targetSelector);
|
||||||
|
|
||||||
var reader = new commonmark.Parser({safe: true});
|
var reader = new commonmark.Parser({safe: true});
|
||||||
var writer = new commonmark.HtmlRenderer({safe: true});
|
var writer = new commonmark.HtmlRenderer({safe: true, softbreak: '<br />'});
|
||||||
writer.softbreak = '<br />';
|
|
||||||
|
|
||||||
previewTabEl.addEventListener('click', function () {
|
previewTabEl.addEventListener('click', function () {
|
||||||
var parsed = reader.parse(sourceSelector.value.trim());
|
var parsed = reader.parse(sourceSelector.value.trim());
|
||||||
|
|
|
@ -123,8 +123,7 @@
|
||||||
var target = document.getElementById('torrent-description');
|
var target = document.getElementById('torrent-description');
|
||||||
var text = target.innerHTML;
|
var text = target.innerHTML;
|
||||||
var reader = new commonmark.Parser({safe: true});
|
var reader = new commonmark.Parser({safe: true});
|
||||||
var writer = new commonmark.HtmlRenderer({safe: true});
|
var writer = new commonmark.HtmlRenderer({safe: true, softbreak: '<br />'});
|
||||||
writer.softbreak = '<br />';
|
|
||||||
var parsed = reader.parse(text.trim());
|
var parsed = reader.parse(text.trim());
|
||||||
target.innerHTML = writer.render(parsed);
|
target.innerHTML = writer.render(parsed);
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue