Skip to content

Task Lists

Task lists provide interactive checkboxes for tracking progress, creating to-do lists, and managing completion status in your documentation.

Overview

Task lists offer:

  • Interactive checkboxes - Click to toggle completion status
  • Visual progress tracking - See what's done at a glance
  • Nested task support - Create hierarchical task structures
  • Custom styling - Match your theme and branding
  • Accessibility - Keyboard navigation and screen reader support
  • State persistence - Optional JavaScript integration

Configuration

Enable task lists in mkdocs.yml:

markdown_extensions:
  - pymdownx.tasklist:
      custom_checkbox: true      # Enable custom checkbox styling
      clickable_checkbox: true   # Make checkboxes interactive

Configuration Options

Option Type Default Description
custom_checkbox bool false Use custom checkbox styling
clickable_checkbox bool false Allow clicking to toggle state

Basic Usage

Simple Task List

Create task lists with - [ ] for unchecked and - [x] for checked items:

- [x] Create project structure
- [x] Install dependencies
- [ ] Write documentation
- [ ] Add tests
- [ ] Deploy to production

Result:

  • Create project structure
  • Install dependencies
  • Write documentation
  • Add tests
  • Deploy to production

Nested Task Lists

Create hierarchical tasks:

- [x] Phase 1: Setup
  - [x] Initialize repository
  - [x] Configure build tools
  - [x] Set up CI/CD
- [ ] Phase 2: Development
  - [x] Core functionality
  - [ ] User interface
  - [ ] API integration
- [ ] Phase 3: Launch
  - [ ] Testing
  - [ ] Documentation
  - [ ] Deployment

Result:

  • Phase 1: Setup
  • Initialize repository
  • Configure build tools
  • Set up CI/CD
  • Phase 2: Development
  • Core functionality
  • User interface
  • API integration
  • Phase 3: Launch
  • Testing
  • Documentation
  • Deployment

Advanced Features

Mixed Content Lists

Combine tasks with regular list items:

Project Requirements:
- Database setup
  - [x] Install PostgreSQL
  - [x] Create database schema
  - [ ] Import sample data
- Authentication system
  - [ ] User registration
  - [ ] Login functionality
  - [ ] Password reset
- Additional notes
  - Remember to update documentation
  - Schedule review meeting

Result:

Project Requirements: - Database setup - [x] Install PostgreSQL - [x] Create database schema - [ ] Import sample data - Authentication system - [ ] User registration - [ ] Login functionality - [ ] Password reset - Additional notes - Remember to update documentation - Schedule review meeting

Task Lists in Tables

Feature Status Priority Assignee
User Authentication - [x] Complete High John
Data Import - [ ] In Progress Medium Sarah
Report Generation - [ ] Pending Low Mike
API Documentation - [x] Complete High Lisa

Task Lists in Admonitions

Implementation Checklist

Follow these steps to implement the feature:

  • Review requirements
  • Design architecture
  • Write code
  • Add unit tests
  • Update documentation
  • Code review
  • Deploy to staging

Styling

Custom CSS

/* Custom task list styling */
.md-typeset .task-list-item {
    position: relative;
    list-style: none;
}

.md-typeset .task-list-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.md-typeset .task-list-item input[type="checkbox"] + label {
    display: inline-block;
    position: relative;
    padding-left: 1.5em;
    cursor: pointer;
}

.md-typeset .task-list-item input[type="checkbox"] + label:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.2em;
    width: 1em;
    height: 1em;
    border: 2px solid var(--md-primary-fg-color);
    border-radius: 2px;
    background-color: var(--md-default-bg-color);
    transition: all 0.3s;
}

.md-typeset .task-list-item input[type="checkbox"]:checked + label:before {
    background-color: var(--md-primary-fg-color);
}

.md-typeset .task-list-item input[type="checkbox"]:checked + label:after {
    content: "✓";
    position: absolute;
    left: 0.2em;
    top: 0.1em;
    color: var(--md-primary-bg-color);
    font-weight: bold;
}

Interactive Features

Enable checkbox interaction with JavaScript:

// Enable interactive checkboxes
document.addEventListener('DOMContentLoaded', function() {
    const checkboxes = document.querySelectorAll('.task-list-item input[type="checkbox"]');

    checkboxes.forEach(checkbox => {
        checkbox.disabled = false;
        checkbox.addEventListener('change', function() {
            // Save state to localStorage
            const id = this.id || this.parentElement.textContent.trim();
            localStorage.setItem(`task-${id}`, this.checked);

            // Update visual feedback
            if (this.checked) {
                this.parentElement.style.textDecoration = 'line-through';
                this.parentElement.style.opacity = '0.7';
            } else {
                this.parentElement.style.textDecoration = 'none';
                this.parentElement.style.opacity = '1';
            }
        });
    });
});

Use Cases

Project Management

## Sprint 1 Tasks

### High Priority
- [x] Fix critical bug in authentication
- [x] Update database schema
- [ ] Implement new API endpoint

### Medium Priority
- [ ] Refactor user service
- [ ] Add logging to payment module
- [ ] Update documentation

### Low Priority
- [ ] Clean up deprecated code
- [ ] Optimize image loading

Installation Guide

## Installation Steps

- [ ] Download the latest release
- [ ] Extract the archive
- [ ] Run the installer
  - [ ] Accept license agreement
  - [ ] Choose installation directory
  - [ ] Select components
- [ ] Configure settings
- [ ] Verify installation
- [ ] Run test suite

Learning Path

## Python Learning Track

### Beginner
- [x] Python basics and syntax
- [x] Variables and data types
- [ ] Control flow (if/else, loops)
- [ ] Functions and modules

### Intermediate
- [ ] Object-oriented programming
- [ ] File handling
- [ ] Error handling
- [ ] Working with APIs

### Advanced
- [ ] Decorators and generators
- [ ] Async programming
- [ ] Testing and debugging
- [ ] Performance optimization

Progress Tracking

Visual Progress Indicators

Overall Progress: 40%

Module 1: Fundamentals - [x] Introduction - [x] Setup environment - [ ] Basic concepts - [ ] Exercises

Module 2: Advanced Topics - [ ] Deep dive - [ ] Practical examples - [ ] Case studies - [ ] Final project

Dynamic Progress Calculation

// Calculate and display progress
function updateProgress() {
    const tasks = document.querySelectorAll('.task-list-item input[type="checkbox"]');
    const completed = document.querySelectorAll('.task-list-item input[type="checkbox"]:checked');

    const percentage = Math.round((completed.length / tasks.length) * 100);

    document.getElementById('progress-bar').style.width = percentage + '%';
    document.getElementById('progress-text').textContent = percentage + '% Complete';
}

Best Practices

1. Clear Task Descriptions

✅ Good:
- [ ] Update user authentication to use JWT tokens

❌ Bad:
- [ ] Fix auth

2. Logical Grouping

✅ Good:
### Frontend Tasks
- [ ] Update UI components
- [ ] Add responsive design

### Backend Tasks
- [ ] Optimize database queries
- [ ] Add caching layer

3. Actionable Items

✅ Good:
- [ ] Write unit tests for UserService class

❌ Bad:
- [ ] Testing

4. Appropriate Granularity

✅ Good:
- [ ] Implement user registration
  - [ ] Create registration form
  - [ ] Validate input data
  - [ ] Save to database
  - [ ] Send confirmation email

❌ Bad:
- [ ] Build entire application

Accessibility

Task lists include proper ARIA attributes:

<li class="task-list-item">
  <input type="checkbox" id="task1" role="checkbox" aria-checked="false">
  <label for="task1">Task description</label>
</li>

Keyboard Navigation

  • Tab - Navigate between checkboxes
  • Space - Toggle checkbox state
  • Enter - Toggle checkbox state

Integration Examples

With Definition Lists

Development Workflow

The standard process for feature development

  • Create feature branch
  • Implement changes
  • Write tests
  • Submit pull request
  • Code review
  • Merge to main

With Code Blocks

# TODO: Complete these tasks
# - [x] Import required libraries
# - [ ] Define data models
# - [ ] Implement business logic
# - [ ] Add error handling

import os
import json
from datetime import datetime

# Implementation continues...

Common Patterns

Release Checklist

## Version 2.0 Release

### Pre-release
- [x] Feature freeze
- [x] Code complete
- [ ] Final testing
- [ ] Security audit

### Release Day
- [ ] Tag release
- [ ] Build packages
- [ ] Update documentation
- [ ] Publish to registry

### Post-release
- [ ] Monitor for issues
- [ ] Gather feedback
- [ ] Plan next iteration

Tutorial Progress

## Learn React - Your Progress

### Getting Started ✅
- [x] What is React?
- [x] Setting up environment
- [x] Hello World example

### Core Concepts 🚧
- [x] Components and Props
- [x] State and Lifecycle
- [ ] Handling Events
- [ ] Conditional Rendering

### Advanced Topics ⏳
- [ ] Hooks
- [ ] Context API
- [ ] Performance Optimization

See Also