---
name: extract_markdown_headers
kind: function
lang: py
domain: core
version: "1.0.0"
purity: pure
signature: "def extract_markdown_headers(markdown_content: str) -> tuple[list[dict], list[str]]"
description: "Extrae todos los headers (h1-h6) de markdown con nivel y numero de linea, ignorando code blocks."
tags: [markdown, parsing, headers, extraction, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: [re]
params:
  - name: markdown_content
    desc: "string con contenido markdown"
output: "tupla (lista_de_headers, lista_de_lineas_originales) donde headers son dicts con title/level/line_num"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/core/core.py"
source_repo: "https://github.com/VectifyAI/PageIndex"
source_license: "MIT"
source_file: "pageindex/page_index_md.py"
---

## Ejemplo

```python
md = "# Title\n\nSome text\n\n## Section\n\n```\n# not a header\n```"
headers, lines = extract_markdown_headers(md)
# headers = [{"title": "Title", "level": 1, "line_num": 1}, {"title": "Section", "level": 2, "line_num": 5}]
```

## Notas

Funcion pura. Detecta y omite bloques de codigo (triple backtick). Retorna tupla: (lista de headers, lista de lineas originales).
