Skip to main content

Python Markdown extension for task lists with checkboxes

Project description

Markdown Checklist

a Python Markdown extension for lists of tasks with checkboxes

inspired by GitHub task lists:

* [ ] 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markdown-checklist-0.4.3.tar.gz (7.3 kB view details)

Uploaded Source

File details

Details for the file markdown-checklist-0.4.3.tar.gz.

File metadata

  • Download URL: markdown-checklist-0.4.3.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for markdown-checklist-0.4.3.tar.gz
Algorithm Hash digest
SHA256 4e9e76bfe72e2d1bb8e12c9599b3d23305662b356623d48b52caf351fff3d93f
MD5 e300f24f1096beff049586533591d384
BLAKE2b-256 d434e10d414ece4b231459ce2b27a0112ee5744593f46ca78a915a2ad8309465

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page