npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

markdown-it-task-lists-ts

v1.0.4

Published

A TypeScript-first markdown-it plugin that converts GitHub-style task lists to HTML checkboxes

Downloads

29

Readme

markdown-it-task-lists-ts

A TypeScript-first markdown-it plugin that converts GitHub-style task lists to HTML checkboxes. Built with type safety and customization in mind.

Features

  • Full TypeScript support with comprehensive type definitions
  • Customizable CSS classes for all elements
  • Support for nested task lists
  • Configurable checkbox behavior (enabled/disabled)
  • Accessible HTML output with proper labeling
  • Zero dependencies (except for markdown-it peer dependency)

Installation

npm install markdown-it-task-lists-ts
# or
yarn add markdown-it-task-lists-ts

Usage

import MarkdownIt from 'markdown-it';
import taskLists, { type TaskListOptions } from 'markdown-it-task-lists-ts';

const md = new MarkdownIt();

// Basic usage with default options
md.use(taskLists);

// Usage with custom options
md.use(taskLists, {
  enabled: true,           // Enable checkbox interaction
  label: true,            // Wrap checkboxes in labels
  labelAfter: false,      // Place label before checkbox
  listClass: 'todo-list', // Custom class for ul elements
  itemClass: 'todo-item', // Custom class for li elements
  checkboxClass: 'todo-checkbox', // Custom class for input elements
  labelClass: 'todo-label',        // Custom class for label elements
  tiptapCompatible: true // Output HTML compatible with Tiptap's task list extension
});

// Convert markdown to HTML
const markdown = `
- [ ] Unchecked task
- [x] Checked task
  - [ ] Nested task
`;

const html = md.render(markdown);

Output HTML

The plugin generates semantic HTML with proper ARIA attributes and customizable classes:

<ul class="contains-task-list">
  <li class="task-list-item">
    <label class="task-list-item-label" for="task-item-1">
      <input class="task-list-item-checkbox" type="checkbox" id="task-item-1">
      Unchecked task
    </label>
  </li>
  <li class="task-list-item">
    <label class="task-list-item-label" for="task-item-2">
      <input class="task-list-item-checkbox" type="checkbox" checked id="task-item-2">
      Checked task
    </label>
    <ul class="contains-task-list">
      <li class="task-list-item">
        <label class="task-list-item-label" for="task-item-3">
          <input class="task-list-item-checkbox" type="checkbox" id="task-item-3">
          Nested task
        </label>
      </li>
    </ul>
  </li>
</ul>

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | enabled | boolean | false | When true, checkboxes are interactive. When false, they have the disabled attribute. | | label | boolean | true | When true, wraps checkboxes in label elements for better accessibility and UX. | | labelAfter | boolean | false | When true, places the label after the checkbox instead of before. | | listClass | string | 'contains-task-list' | CSS class for the ul element containing task items. | | itemClass | string | 'task-list-item' | CSS class for the li elements containing tasks. | | checkboxClass | string | 'task-list-item-checkbox' | CSS class for the checkbox input elements. | | labelClass | string | 'task-list-item-label' | CSS class for the label elements (when label option is true). | | tiptapCompatible | boolean | false | Whether to output HTML compatible with Tiptap's task list extension |

Tiptap Compatibility

When tiptapCompatible is set to true, the plugin will output HTML that is compatible with Tiptap's task list extension:

<ul data-type="taskList">
  <li data-type="taskItem" data-checked="false">Unchecked task</li>
  <li data-type="taskItem" data-checked="true">Checked task</li>
</ul>

This is useful when using the plugin with Tiptap's TaskList and TaskItem extensions.

Example:

import MarkdownIt from 'markdown-it';
import taskLists, { type TaskListOptions } from 'markdown-it-task-lists-ts';

const md = new MarkdownIt();
md.use(taskLists, {
  enabled: true,
  label: true,
  tiptapCompatible: true
});

Styling

The plugin provides default classes that you can style, or you can specify your own classes through the options:

/* Default styling */
.contains-task-list {
  list-style-type: none;
  padding-left: 0;
}

.task-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-list-item-checkbox {
  margin: 0;
}

.task-list-item-label {
  cursor: pointer;
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

MIT License - see the LICENSE file for details.