Skip to content

Commit

Permalink
✨ Added support for GFM task lists in replies; Fixes #35
Browse files Browse the repository at this point in the history
  • Loading branch information
jerone committed Mar 6, 2015
1 parent 0f93e59 commit b6e3cbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Github_Comment_Enhancer/Github_Comment_Enhancer.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@
}

// Source: https://github.com/domchristie/to-markdown
// Code is altered with task list support: https://github.com/domchristie/to-markdown/pull/62
var toMarkdown = function(string) {

var ELEMENTS = [{
Expand Down Expand Up @@ -632,7 +633,9 @@
if (lis[i]) {
var prefix = (listType === 'ol') ? (i + 1) + ". " : "* ";
lis[i] = lis[i].replace(/\s*<li[^>]*>([\s\S]*)/i, function(str, innerHTML) {

innerHTML = innerHTML.replace(/\s*<input[^>]*?(checked[^>]*)?type=['"]?checkbox['"]?[^>]>/, function(inputStr, checked) {
return checked ? '[X]' : '[ ]';
});
innerHTML = innerHTML.replace(/^\s+/, '');
innerHTML = innerHTML.replace(/\n\n/g, '\n\n ');
// indent nested lists
Expand Down
2 changes: 2 additions & 0 deletions Github_Comment_Enhancer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Add features to enhance comments & wiki on [Github](https://github.com) and comm

## Version History

* **vNext**
* Added support for GFM task lists in replies (fixes https://github.com/jerone/UserScripts/issues/35);
* **2.1.0**
* Added tab character as a snippet (thnx to [r-a-y](https://github.com/r-a-y), fixes https://github.com/jerone/UserScripts/issues/41);
* Updated toMarkdown for replies;
Expand Down

0 comments on commit b6e3cbe

Please sign in to comment.