Skip to content

Scope docs checkpoint tracker to checklist items after the Checkpoint heading#2243

Merged
pelikhan merged 1 commit into
mainfrom
copilot/update-checkout-docs-tracker
Jul 27, 2026
Merged

Scope docs checkpoint tracker to checklist items after the Checkpoint heading#2243
pelikhan merged 1 commit into
mainfrom
copilot/update-checkout-docs-tracker

Conversation

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The docs progress tracker currently counts every task-list item on a page, including non-checkpoint lists. This change narrows tracking to checklist items that appear after the page’s Checkpoint heading, so progress reflects checkpoint completion only.

  • Tracker scope

    • Added a getCheckpointItems(page) selector that:
      • finds the first heading matching Checkpoint (with optional prefix)
      • returns only li.task-list-item nodes that follow that heading in document order
    • initPage now initializes state from this scoped list instead of all task-list items on the page.
  • Behavioral impact

    • Progress bar, completion state, and “all checkpoints complete” banner now ignore pre-checkpoint checklists.
    • Pages without a Checkpoint heading are intentionally skipped by the tracker.
function getCheckpointItems(page) {
  var checkpointTitle = null;
  var headings = page.querySelectorAll('h1, h2, h3, h4, h5, h6');
  Array.prototype.some.call(headings, function (heading) {
    if (/^?\s*checkpoint$/i.test(heading.textContent.trim())) {
      checkpointTitle = heading;
      return true;
    }
    return false;
  });
  if (!checkpointTitle) return [];

  return Array.from(page.querySelectorAll('li.task-list-item')).filter(function (li) {
    return checkpointTitle.compareDocumentPosition(li) & Node.DOCUMENT_POSITION_FOLLOWING;
  });
}

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Update docs checkbox tracker to only count checkpoint checklist items Scope docs checkpoint tracker to checklist items after the Checkpoint heading Jul 27, 2026
Copilot AI requested a review from pelikhan July 27, 2026 11:54
@pelikhan
pelikhan marked this pull request as ready for review July 27, 2026 11:55
@pelikhan
pelikhan merged commit 18b061f into main Jul 27, 2026
7 checks passed
@pelikhan
pelikhan deleted the copilot/update-checkout-docs-tracker branch July 27, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants