{
  "slug": "markdown-section-extractor",
  "name": "gizza-ai/markdown-section-extractor",
  "version": "0.1.0",
  "title": "Markdown Section Extractor — Pull One Section by Heading — gizza.ai",
  "description": "Extract one section from a Markdown document by heading — keep or drop subsections, exact or substring match, ATX and setext. Free, in your browser.",
  "tags": [
    "markdown",
    "section extractor",
    "heading",
    "extract section",
    "markdown parser",
    "split markdown",
    "subsection",
    "documentation",
    "readme"
  ],
  "category": "documents",
  "urls": {
    "page": "https://gizza.ai/tools/markdown-section-extractor/",
    "markdown": "https://gizza.ai/tools/markdown-section-extractor/index.md",
    "descriptor": "https://gizza.ai/tools/markdown-section-extractor/tool.json",
    "deep_link_example": "https://gizza.ai/tools/markdown-section-extractor/?markdown=%23%20Title%0A%0A%23%23%20Installation%0A%0ARun%20the%20installer...%0A%0A%23%23%20Usage%0A%0A...&heading=Installation&match_mode=exact&include_subsections=true&include_heading=true"
  },
  "cli": "gizza tool markdown-section-extractor \"# Title\n\n## Installation\n\nRun the installer...\n\n## Usage\n\n...\" 'heading=Installation'",
  "tool": {
    "description": "Extract a single subsection from a Markdown document by its heading. Give the full document as 'markdown' and the heading text as 'heading' (e.g. 'Installation', without the '#'). Returns the heading and everything beneath it up to the next heading at the same or a shallower level — by default including all deeper nested subsections. Set include_subsections=false to return only the body directly under the heading (stopping at the first deeper heading). Set include_heading=false to omit the heading line. match_mode controls how the heading is found: 'exact' (default, case-insensitive), 'exact_case' (case-sensitive), or 'contains' (substring). Recognizes ATX (#, ##, …) and setext (===/---) headings and skips '#' lines inside fenced code blocks.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "heading": {
          "description": "The heading text of the section to extract (without the leading '#'), e.g. 'Installation'.",
          "type": "string"
        },
        "include_heading": {
          "default": true,
          "description": "When true (default), the matched heading line is the first line of the output. When false, only the section body is returned.",
          "type": "boolean"
        },
        "include_subsections": {
          "default": true,
          "description": "When true (default), the extracted section includes every deeper-nested subsection, ending at the next heading of the same or a shallower level. When false, it stops at the first heading of any level after the target, returning only the body directly under it.",
          "type": "boolean"
        },
        "markdown": {
          "description": "The full Markdown document to extract a section from.",
          "type": "string"
        },
        "match_mode": {
          "default": "exact",
          "description": "How to match the heading: 'exact' (default) is a case-insensitive exact match of the trimmed heading text; 'exact_case' is case-sensitive; 'contains' matches any heading whose text contains the query (case-insensitive). The first matching heading wins.",
          "enum": [
            "exact",
            "exact_case",
            "contains"
          ],
          "type": "string"
        }
      },
      "required": [
        "markdown",
        "heading"
      ],
      "type": "object"
    }
  }
}