diff --git a/README.md b/README.md index f40bfd2..e267f45 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ [![npm version](https://badge.fury.io/js/showdown.svg)](http://badge.fury.io/js/showdown) [![Bower version](https://badge.fury.io/bo/showdown.svg)](http://badge.fury.io/bo/showdown) [![Join the chat at https://gitter.im/showdownjs/showdown](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/showdownjs/showdown?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Greenkeeper badge](https://badges.greenkeeper.io/showdownjs/showdown.svg)](https://greenkeeper.io/) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/tiviesantos) ------ @@ -17,11 +16,9 @@ Showdown can be used client side (in the browser) or server side (with NodeJs). Check a live Demo here http://demo.showdownjs.com/ -## [![Patreon](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/bePatron?u=11141581) - As you know, ShowdownJS is a free library and it will remain free forever. However, maintaining and improving the library costs time and money. -If you like our work and find our library useful, please donate through [patreon](https://www.patreon.com/showdownjs) or directly through [paypal](https://www.paypal.me/tiviesantos)!! Your contribution will be greatly appreciated and help me continue to develop this awesome library. +If you like our work and find our library useful, please donate through [paypal](https://www.paypal.me/tiviesantos)!! Your contribution will be greatly appreciated and help me continue to develop this awesome library. ## License @@ -369,6 +366,10 @@ var defaultOptions = showdown.getDefaultOptions(); * **splitAdjacentBlockquotes**: (boolean) [default false] Split adjacent blockquote blocks.(since v.1.8.6) + * **moreStyling**: (boolean) [default false] Adds some useful classes for css styling. (since v2.0.1) + + - Tasklists: Adds the class `task-list-item-complete` to completed tasks items in GFM tasklists. + **NOTE**: Please note that until **version 1.6.0**, all of these options are ***DISABLED*** by default in the cli tool. diff --git a/dist/showdown.js b/dist/showdown.js index 76c921d..eb948b8 100644 Binary files a/dist/showdown.js and b/dist/showdown.js differ diff --git a/dist/showdown.js.map b/dist/showdown.js.map index e1da0a1..05576ac 100644 Binary files a/dist/showdown.js.map and b/dist/showdown.js.map differ diff --git a/dist/showdown.min.js b/dist/showdown.min.js index 444e5c4..299562e 100644 Binary files a/dist/showdown.min.js and b/dist/showdown.min.js differ diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index bfb6b8d..863a790 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/options.js b/src/options.js index 3504fe6..0e32913 100644 --- a/src/options.js +++ b/src/options.js @@ -166,6 +166,11 @@ function getDefaultOpts (simple) { description: 'Split adjacent blockquote blocks', type: 'boolean' }, + moreStyling: { + defaultValue: false, + describe: 'Adds some useful styling css classes in the generated html', + type: 'boolean' + }, relativePathBaseUrl: { defaultValue: false, describe: 'Prepends a base URL to relative paths', diff --git a/src/subParsers/makehtml/lists.js b/src/subParsers/makehtml/lists.js index 1473a9c..77a86b2 100644 --- a/src/subParsers/makehtml/lists.js +++ b/src/subParsers/makehtml/lists.js @@ -40,7 +40,7 @@ showdown.subParser('makehtml.lists', function (text, options, globals) { // attacklab: add sentinel to emulate \z listStr += '¨0'; - var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, + var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[([xX ])])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr)); // Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation, @@ -48,7 +48,7 @@ showdown.subParser('makehtml.lists', function (text, options, globals) { // activating this option reverts to old behavior // This will be removed in version 2.0 if (options.disableForced4SpacesIndentedSublists) { - rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm; + rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[([xX ])])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm; } listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) { @@ -59,8 +59,13 @@ showdown.subParser('makehtml.lists', function (text, options, globals) { // Support for github tasklists if (taskbtn && options.tasklists) { - bulletStyle = ' class="task-list-item" style="list-style-type: none;"'; - item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () { + + // Style used for tasklist bullets + bulletStyle = ' class="task-list-item'; + if (options.moreStyling) {bulletStyle += checked ? ' task-list-item-complete' : '';} + bulletStyle += '" style="list-style-type: none;"'; + + item = item.replace(/^[ \t]*\[([xX ])?]/m, function () { var otp = ' +