Skip to content

Instantly share code, notes, and snippets.

@muhqu
Last active December 18, 2015 19:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muhqu/5831075 to your computer and use it in GitHub Desktop.
Save muhqu/5831075 to your computer and use it in GitHub Desktop.
#!/bin/bash
/usr/local/bin/marked "$@" \
| sed \
-e 's!\[\ \]!<input type="checkbox" onclick="return false" onkeydown="return false">!' \
-e 's!\[[.\-]\]!<input type="checkbox" onclick="return false" onkeydown="return false" indeterminate>!' \
-e 's!\[[√xX]\]!<input type="checkbox" onclick="return false" onkeydown="return false" checked>!' \
| awk '{print;if($0~/indeterminate/)found=1;}END{if(found)print "<script>window.addEventListener(\"load\",function(){var arr=document.querySelectorAll(\"input[type=checkbox][indeterminate]\");for(i in arr)arr[i].indeterminate=true;});</script>"}'

GitHub style Task List in Marked.app

  • Implement via custom processor
  • [.] Allow toggle of tasks
  • Ship with Marked.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment