mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 14:00:00 +00:00
Merge pull request #88 from nyaadevs/commonmark
Switch marked to commonmark
This commit is contained in:
commit
de5a15b9a0
|
@ -105,8 +105,13 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
var previewTabEl = markdownEditor.querySelector(previewTabSelector);
|
||||
var targetEl = markdownEditor.querySelector(targetSelector);
|
||||
|
||||
var reader = new commonmark.Parser({safe: true});
|
||||
var writer = new commonmark.HtmlRenderer({safe: true});
|
||||
writer.softbreak = '<br />';
|
||||
|
||||
previewTabEl.addEventListener('click', function () {
|
||||
targetEl.innerHTML = marked(sourceSelector.value.trim(), { sanitize: true, breaks:true });
|
||||
var parsed = reader.parse(sourceSelector.value.trim());
|
||||
targetEl.innerHTML = writer.render(parsed);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<!-- Modified to not apply border-radius to selectpickers and stuff so our navbar looks cool -->
|
||||
<script src="/static/js/bootstrap-select.js"></script>
|
||||
<script src="/static/js/main.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/commonmark/0.27.0/commonmark.min.js"></script>
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
|
|
|
@ -122,8 +122,11 @@
|
|||
<script>
|
||||
var target = document.getElementById('torrent-description');
|
||||
var text = target.innerHTML;
|
||||
var html = marked(text.trim(), { sanitize: true, breaks:true });
|
||||
target.innerHTML = html;
|
||||
var reader = new commonmark.Parser({safe: true});
|
||||
var writer = new commonmark.HtmlRenderer({safe: true});
|
||||
writer.softbreak = '<br />';
|
||||
var parsed = reader.parse(text.trim());
|
||||
target.innerHTML = writer.render(parsed);
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue