-
Notifications
You must be signed in to change notification settings - Fork 33
/
README
60 lines (43 loc) · 1.73 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[Markdown Checklist](https://github.com/FND/markdown-checklist)
[![build status](https://secure.travis-ci.org/FND/markdown-checklist.png)](http://travis-ci.org/FND/markdown-checklist)
[![coverage](https://coveralls.io/repos/FND/markdown-checklist/badge.png)](https://coveralls.io/r/FND/markdown-checklist)
a [Python Markdown](http://pythonhosted.org/Markdown/) extension for lists of
tasks with checkboxes
inspired by
[GitHub task lists](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments):
* [ ] foo
* [x] bar
* [ ] baz
becomes
<ul>
<li><input type="checkbox" disabled> foo</li>
<li><input type="checkbox" disabled checked> bar</li>
<li><input type="checkbox" disabled> baz</li>
</ul>
* a dash can be used instead of an asterisk for list items
* both upper- and lowercase "x" are accepted to activate checkboxes
Installation
------------
$ pip install markdown-checklist
Usage
-----
import markdown
html = markdown.markdown(source, extensions=['markdown_checklist.extension'])
or
import markdown
from markdown_checklist.extension import ChecklistExtension
html = markdown.markdown(source, extensions=[ChecklistExtension()])
There is also a small JavaScript/jQuery library to make checkboxes interactive:
new Checklists("article", function(checkbox, callback) {
var uri = checkbox.closest("article").find("h1 a").attr("href");
jQuery.get(uri, callback);
}, function(markdown, checkbox, callback) {
var uri = checkbox.closest("article").find("h1 a").attr("href");
jQuery.ajax({
type: "put",
uri: uri,
data: markdown,
success: callback
});
});
See included `checklists.js` for details.