X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/c9700e38e2adc5c5a1e7a44e69f58b7827983885..refs/pull/360/head:/resources/assets/js/directives.js diff --git a/resources/assets/js/directives.js b/resources/assets/js/directives.js index ef8bcd85c..10458e753 100644 --- a/resources/assets/js/directives.js +++ b/resources/assets/js/directives.js @@ -214,6 +214,19 @@ export default function (ngApp, events) { } }]); + let renderer = new markdown.Renderer(); + // Custom markdown checkbox list item + // Attribution: https://github.com/chjj/marked/issues/107#issuecomment-44542001 + renderer.listitem = function(text) { + if (/^\s*\[[x ]\]\s*/.test(text)) { + text = text + .replace(/^\s*\[ \]\s*/, '') + .replace(/^\s*\[x\]\s*/, ''); + return `