forked from vintasoftware/django-apps-checklist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarkdown-it-task-lists.min.js
2 lines (2 loc) · 2.23 KB
/
markdown-it-task-lists.min.js
1
2
/*! markdown-it-task-lists 1.4.0 https://github.com/revin/markdown-it-task-lists#readme by @license {ISC} */
!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.markdownitTaskLists=n()}}(function(){return function n(e,t,i){function r(c,f){if(!t[c]){if(!e[c]){var u="function"==typeof require&&require;if(!f&&u)return u(c,!0);if(o)return o(c,!0);var l=new Error("Cannot find module '"+c+"'");throw l.code="MODULE_NOT_FOUND",l}var s=t[c]={exports:{}};e[c][0].call(s.exports,function(n){var t=e[c][1][n];return r(t?t:n)},s,s.exports,n,e,t,i)}return t[c].exports}for(var o="function"==typeof require&&require,c=0;c<i.length;c++)r(i[c]);return r}({1:[function(n,e,t){function i(n,e,t){var i=n.attrIndex(e),r=[e,t];0>i?n.attrPush(r):n.attrs[i]=r}function r(n,e){for(var t=n[e].level-1,i=e-1;i>=0;i--)if(n[i].level===t)return i;return-1}function o(n,e){return s(n[e])&&a(n[e-1])&&d(n[e-2])&&p(n[e])}function c(n,e){n.children.unshift(f(n,e)),n.children[1].content=n.children[1].content.slice(3),n.content=n.content.slice(3),x&&(n.children.unshift(u(e)),n.children.push(l(e)))}function f(n,e){var t=new e("html_inline","",0),i=h?' disabled="" ':"";return 0===n.content.indexOf("[ ]")?t.content='<input class="task-list-item-checkbox"'+i+'type="checkbox">':(0===n.content.indexOf("[x]")||0===n.content.indexOf("[X]"))&&(t.content='<input class="task-list-item-checkbox" checked=""'+i+'type="checkbox">'),t}function u(n){var e=new n("html_inline","",0);return e.content="<label>",e}function l(n){var e=new n("html_inline","",0);return e.content="</label>",e}function s(n){return"inline"===n.type}function a(n){return"paragraph_open"===n.type}function d(n){return"list_item_open"===n.type}function p(n){return 0===n.content.indexOf("[ ]")||0===n.content.indexOf("[x]")||0===n.content.indexOf("[X]")}var h=!0,x=!1;e.exports=function(n,e){e&&(h=!e.enabled,x=!!e.label),n.core.ruler.after("inline","github-task-lists",function(n){for(var e=n.tokens,t=2;t<e.length;t++)o(e,t)&&(c(e[t],n.Token),i(e[t-2],"class","task-list-item"),i(e[r(e,t-2)],"class","task-list"))})}},{}]},{},[1])(1)});