googlearchive / py-gfm

This repository is unmaintained. Please see Zopieux/py-gfm for the new canonical repository.
https://github.com/Zopieux/py-gfm
BSD 3-Clause "New" or "Revised" License
73 stars 30 forks source link

Add support for highly customizable, GitHub-like, task lists #27

Closed zopieux closed 8 years ago

zopieux commented 8 years ago

Fixes #1. I am not sure about the copyright heading you want me to use. Feel free to request a modification. Code was tested on Python 2.7, 3.4 and 3.5. I had to make minor changes in test.py to that end.


An extension that supports task lists, that are simply lists of checkboxes. Both ordered and unordered lists are supported and can be separately enabled. Nested lists are supported.

By default, unchecked boxes ares represented by [ ]. Customize the pattern with option unchecked. You can use a list. By default, checked boxes are represented by [x] or [X]. Customize the pattern with option checked. You can use a list. Checked patterns are tested before unchecked patterns.

Example:

- [x] milk
- [ ] eggs
- [x] chocolate
- [ ] if possible:
    1. [ ] solve world peace
    2. [ ] solve world hunger

Set option unordered to False to disable parsing of unordered lists. Set option ordered to False to disable parsing of ordered lists.

You can limit the nesting of task lists by setting the max_depth option. Default is unlimited nesting.

Option item_attrs accepts an attribute dict or a callable that takes the following arguments:

and that should return an attribute dict. These attributes are added to the <li> element where the checkbox is put.

Option checkbox_attrs accepts an attribute dict or a callable that takes the following arguments:

and that should return an attribute dict. These attributes are added to the checkbox element.

Note: Github has support for updating the markdown source by toggling the checkbox (by clicking on it). This is not supported by this extension, as it requires server-side processing that is out of scope of a markdown parser.

zopieux commented 8 years ago

As per this Travis build, all tests pass for Python 2.7 to 3.5, including the one added by this PR.

zopieux commented 8 years ago

This repository's maintainership was transferred to my fork. Closing the PR.