ChatGPT to Markdown
A tool-first CLI that converts ChatGPT exports into a structured, searchable, offline-friendly Markdown knowledge archive.
Elevator Pitch
chatgpt-to-markdown turns your ChatGPT export into clean Markdown you can read,
index, and keep long term. Instead of browsing a raw ZIP or JSON partitions, you
get a portable archive with conversation pages, media resolution, metadata files,
and index pages, ready for local browsing, static hosting, or personal knowledge
management workflows.
Project under active development.
chatgpt-to-markdownis still under active development. Not all possible ChatGPT export variants and edge-case output structures are covered yet.Please validate the generated Markdown archive before relying on it as your only source of truth, and please report issues (with repro details when possible) so we can make the tool more robust and feature-complete.
For safety and recoverability, keep your original ChatGPT export ZIP stored securely. As issues are fixed, you can regenerate the output from that source to pick up improvements.
Features
- Parses all
conversations-*.jsonpartitions with Pydantic v2 validation - Walks message DAGs to linearise conversation threads (handles branches and cycles)
- Resolves
file-service://andsediment://asset pointers against the export manifest - Renders conversations to Markdown with YAML front matter via Jinja2 templates
- Generates index files for conversations, DALL-E generations, and metadata
- Deduplicates media by SHA-256 hash
- Supports 12+ content types with a fallback for unknown types
- Optional PII redaction for user metadata
- Optional inclusion of thinking/reasoning blocks from o-series models
- Accepts both extracted directories and ZIP files as input
Installation
Run without installing
uvx chatgpt-to-markdown --help
Convert a ChatGPT export ZIP or extracted directory to a Markdown archive:
# From ZIP file
uvx chatgpt-to-markdown ./chatgpt-export.zip ./archive_zip
# From extracted directory
uvx chatgpt-to-markdown ./chatgpt-export ./archive
Install as a global CLI tool with uv (recommended for frequent use)
uv tool install chatgpt-to-markdown
Development install (contributors)
git clone https://github.com/difegam/chatgpt-to-markdown.git
cd chatgpt-to-markdown
uv sync --all-groups
Usage
# Run without installing (ephemeral env)
uvx chatgpt-to-markdown ./chatgpt-export.zip ./archive
# Or use the installed global CLI
chatgpt-to-markdown ./chatgpt-export.zip ./archive
# Convert an extracted export directory
uvx chatgpt-to-markdown ./my-export ./archive
# Convert a ZIP file directly
uvx chatgpt-to-markdown ./chatgpt-export.zip ./archive
# With options
uvx chatgpt-to-markdown ./my-export ./archive --no-redact-pii --include-thinking
# From a local repository checkout (contributors)
uv run chatgpt-to-markdown ./my-export ./archive
CLI Options
| Option | Default | Description |
|---|---|---|
input_dir |
required | Path to extracted ChatGPT export directory or ZIP file |
output_dir |
required | Path to output Markdown archive directory |
--redact-pii / --no-redact-pii |
True |
Redact PII (email, phone, birth year) in metadata |
--include-thinking |
False |
Include thinking/reasoning blocks from thinking models |
--deduplicate / --no-deduplicate |
True |
Deduplicate assets by SHA-256 hash |
Output Structure
archive/
├── index.md
├── conversations/
│ ├── index.md
│ └── 2024-08-24_test-chat_17cd7535/
│ ├── index.md
│ ├── media/
│ │ └── 001-a1b2c3d4.jpeg
│ └── attachments/
│ └── document.pdf
├── dalle/
│ ├── index.md
│ └── *.webp
└── metadata/
├── user_profile.md
├── settings.md
├── feedback.md
└── export_stats.md
Development
just init # Install dependencies and pre-commit hooks
just test # Run tests
just check # Run all quality checks
just docs # Serve docs locally
See CONTRIBUTING.md and the documentation for full development guides.
Publishing
This repository includes .github/workflows/publish.yml for PyPI trusted publishing with uv.
Reference: Building and publishing a package using uv
-
Create the
pypienvironment in GitHub:Settings → Environments → New environment. -
In PyPI, add a Trusted Publisher for this project with:
- Owner:
difegam - Repository:
chatgpt-to-markdown - Workflow:
publish.yml - Environment:
pypi
- Owner:
-
Create and push a version tag:
git tag -a v0.1.0 -m "v0.1.0" git push --tags
-
The
Publishworkflow runs and executesuv buildanduv publish.
Metadata
Release files for chatgpt-to-markdown 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chatgpt_to_markdown-0.1.0.tar.gz | 18.7 kB | Without provenance | Details for chatgpt_to_markdown-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chatgpt_to_markdown-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for chatgpt_to_markdown-0.1.0-py3-none-any.whl |
Total release size: 50.0 kB
Release files / chatgpt_to_markdown-0.1.0.tar.gz
| Download URL | chatgpt_to_markdown-0.1.0.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a5d743d85ff8351b93a86ae376f1b8b13c363a30c11c876fb909a9b7177425f
|
|
BLAKE2b-256 checksum How to use checksums |
da1343d2d031b2bf79b662f14c0dce763a59eae70d272cad1107ad559fbd76fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / chatgpt_to_markdown-0.1.0-py3-none-any.whl
| Download URL | chatgpt_to_markdown-0.1.0-py3-none-any.whl |
|---|---|
| Size | 31.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ad7e4008c0f4e8c4e393fea0e1206f607ab6f3bf7a47388a14020e8303f01a0
|
|
BLAKE2b-256 checksum How to use checksums |
6a3409c734bf087989f797bcedefef46c443acd412f2003d4975583ed97f2682
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for chatgpt-to-markdown 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.