Skip to content

Commit 478a0e4

Browse files
committed
Merge pull request #251 from samb0t/case-insensitive-checkboxes
Support for case-insensitive checkboxes for render. [x] == [X]
2 parents 452c428 + 656aa98 commit 478a0e4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/subParsers/lists.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ showdown.subParser('lists', function (text, options, globals) {
4141
// attacklab: add sentinel to emulate \z
4242
listStr += '~0';
4343

44-
var rgx = /(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+((\[(x| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,
44+
var rgx = /(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,
4545
isParagraphed = (/\n[ \t]*\n(?!~0)/.test(listStr));
4646

4747
listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
@@ -52,7 +52,7 @@ showdown.subParser('lists', function (text, options, globals) {
5252
// Support for github tasklists
5353
if (taskbtn && options.tasklists) {
5454
bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
55-
item = item.replace(/^[ \t]*\[(x| )?]/m, function () {
55+
item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
5656
var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
5757
if (checked) {
5858
otp += ' checked';

0 commit comments

Comments
 (0)