---
title: "Markdown Numbered List action for ActionClip"
canonical_url: "https://actionclip.app/actions/markdown-numbered-list"
document_type: "standalone_action"
official: true
action_count: 1
catalog_schema_version: 1
catalog_revision: "2026-08-21.1"
catalog_published_at: "2026-08-20T18:50:00Z"
---

# Markdown Numbered List action for ActionClip

Turn selected lines into a numbered Markdown list.

## What it does

Numbers non-empty lines, preserves nesting in four-space levels, and restarts numbering inside each nested level.

## Action details

| Field | Value |
| --- | --- |
| Category | Markdown |
| Action type | JavaScript |
| Result | Replace or copy text |
| Internet | Not required |

## Action and outcome

| Action | Outcome |
| --- | --- |
| **Markdown Numbered List** — Selected text: Draft Review Publish | 1. Draft 1. Review 2. Publish |

## How to turn selected lines into a numbered Markdown list with ActionClip

1. Select the text you want to use.
2. Choose **Markdown Numbered List** from ActionClip.
3. Review the result, then replace the selection or copy the new text.

## Requirements

No setup required.

## Privacy

Runs locally in ActionClip’s JavaScript sandbox. Selected text does not leave your Mac.

## Action configuration

````javascript
function run(selected_text) {
  const counters = [];
  let previousLevel = 0;
  const output = [];

  selected_text.split(/\r\n?|\n/).forEach((line) => {
    if (/^[ \t]*$/.test(line)) return;

    const originalIndent = (line.match(/^[ \t]*/) || [""])[0];
    const expandedIndent = originalIndent.replace(/\t/g, "    ");
    let level = Math.floor(expandedIndent.length / 4);
    level = Math.min(level, previousLevel + 1);

    const content = line
      .slice(originalIndent.length)
      .replace(/^(?:(?:[-+*]|\d+[.)])\s+)?(?:\[[ xX]\]\s+)?/, "")
      .trim();

    counters.length = level + 1;
    counters[level] = (counters[level] || 0) + 1;
    output.push("    ".repeat(level) + counters[level] + ". " + content);
    previousLevel = level;
  });

  return output.join("\n");
}
````

## Links

- [HTML listing](https://actionclip.app/actions/markdown-numbered-list)
- [Download action definition](https://actionclip.app/actions/markdown-numbered-list.actionclip)
- [Browse Markdown actions](https://actionclip.app/marketplace#marketplace-markdown)
- [All Marketplace listings](https://actionclip.app/marketplace)
