Metadata-Version: 2.4
Name: jostack-mdparse
Version: 0.2.0
Summary: Markdown file parser and structured extraction tool
Project-URL: Repository, https://github.com/hyunhee-jo/jostack-mdparse
Project-URL: Issues, https://github.com/hyunhee-jo/jostack-mdparse/issues
Project-URL: Changelog, https://github.com/hyunhee-jo/jostack-mdparse/blob/main/CHANGELOG.md
Author: hyunhee-jo
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: cli,extraction,markdown,parser,structured-data
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing :: Markup :: Markdown
Requires-Python: >=3.10
Description-Content-Type: text/markdown

<!-- AI-AGENT-SUMMARY
name: jostack-mdparse
category: Markdown parser, structured extraction
license: MIT
solves: [Parse Markdown files into structured data, section-level extraction]
input: Markdown files (.md)
output: JSON, text, HTML
sdk: Python
requirements: Python 3.10+
key-differentiators: [CLI + Python API, section filtering, frontmatter extraction, options.json SsoT]
-->

# jostack-mdparse

[![CI](https://github.com/hyunhee-jo/jostack-mdparse/actions/workflows/ci.yml/badge.svg)](https://github.com/hyunhee-jo/jostack-mdparse/actions/workflows/ci.yml)
[![License-Apache_2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)

Markdown file parser and structured extraction tool (CLI + Python API).

## Installation

```bash
pip install jostack-mdparse
```

## Quick Start

### CLI

```bash
# Extract as JSON
jostack-mdparse extract README.md -f json

# Extract specific sections
jostack-mdparse extract docs/ -s "Installation,Usage" -f text

# Print table of contents
jostack-mdparse toc README.md

# Print frontmatter metadata
jostack-mdparse meta blog-post.md
```

### Python API

```python
from jostack_mdparse import extract

# Basic extraction
result = extract("README.md", format="json")

# Filter by heading level
result = extract("docs/guide.md", heading_level="1,2", format="text")

# Extract specific sections
result = extract("README.md", sections="Usage", strip_html=True)
```

## Commands

| Command | Description |
|---------|-------------|
| `extract` | Parse Markdown and output structured data (JSON, text, HTML) |
| `toc` | Print the table of contents (heading tree) |
| `meta` | Print frontmatter metadata as JSON |

## Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `output-dir` | `str` | `None` | Directory where output files are written |
| `format` | `str` | `"json"` | Output format: json, text, html |
| `quiet` | `bool` | `False` | Suppress console logging output |
| `heading-level` | `str` | `None` | Filter by heading levels (comma-separated) |
| `sections` | `str` | `None` | Extract sections by heading text (comma-separated) |
| `include-frontmatter` | `bool` | `True` | Include YAML/TOML frontmatter in output |
| `strip-html` | `bool` | `False` | Strip inline HTML tags |
| `include-code-blocks` | `bool` | `True` | Include fenced code blocks |
| `include-toc` | `bool` | `False` | Add generated table of contents |
| `flatten-lists` | `bool` | `False` | Flatten nested lists |
| `section-separator` | `str` | `None` | Separator between sections in text output |
| `normalize-links` | `bool` | `False` | Convert relative links to absolute |

## Development

```bash
# Install in development mode
pip install -e .

# Run tests
make test

# Run linting
make lint

# Format code
make format
```

## License

[MIT](LICENSE)
