pptx2markdown 0.1.2__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pptx2markdown-0.2.0/PKG-INFO +502 -0
- pptx2markdown-0.2.0/README.ko.md +437 -0
- pptx2markdown-0.2.0/README.md +467 -0
- {pptx2markdown-0.1.2 → pptx2markdown-0.2.0}/pyproject.toml +16 -10
- pptx2markdown-0.2.0/src/pptx2markdown/__init__.py +136 -0
- pptx2markdown-0.2.0/src/pptx2markdown/__main__.py +3 -0
- pptx2markdown-0.2.0/src/pptx2markdown/api.py +243 -0
- pptx2markdown-0.2.0/src/pptx2markdown/assets.py +472 -0
- pptx2markdown-0.2.0/src/pptx2markdown/attachments.py +150 -0
- pptx2markdown-0.2.0/src/pptx2markdown/audit.py +188 -0
- pptx2markdown-0.2.0/src/pptx2markdown/charts.py +104 -0
- pptx2markdown-0.2.0/src/pptx2markdown/chunks.py +125 -0
- pptx2markdown-0.2.0/src/pptx2markdown/cli.py +233 -0
- pptx2markdown-0.2.0/src/pptx2markdown/errors.py +68 -0
- pptx2markdown-0.2.0/src/pptx2markdown/geometry.py +94 -0
- pptx2markdown-0.2.0/src/pptx2markdown/headings.py +320 -0
- pptx2markdown-0.2.0/src/pptx2markdown/images.py +105 -0
- pptx2markdown-0.2.0/src/pptx2markdown/inheritance.py +502 -0
- pptx2markdown-0.2.0/src/pptx2markdown/inline.py +199 -0
- pptx2markdown-0.2.0/src/pptx2markdown/libreoffice.py +82 -0
- pptx2markdown-0.2.0/src/pptx2markdown/mcp_server.py +380 -0
- pptx2markdown-0.2.0/src/pptx2markdown/model.py +324 -0
- pptx2markdown-0.2.0/src/pptx2markdown/omml.py +29 -0
- pptx2markdown-0.2.0/src/pptx2markdown/ooxml.py +428 -0
- pptx2markdown-0.2.0/src/pptx2markdown/ordering.py +105 -0
- pptx2markdown-0.2.0/src/pptx2markdown/paragraphs.py +435 -0
- pptx2markdown-0.2.0/src/pptx2markdown/parser.py +1057 -0
- pptx2markdown-0.2.0/src/pptx2markdown/ppt.py +43 -0
- pptx2markdown-0.2.0/src/pptx2markdown/presentation.py +162 -0
- pptx2markdown-0.2.0/src/pptx2markdown/reading_order.py +411 -0
- pptx2markdown-0.2.0/src/pptx2markdown/recipe.py +432 -0
- pptx2markdown-0.2.0/src/pptx2markdown/render.py +213 -0
- pptx2markdown-0.2.0/src/pptx2markdown/review.py +487 -0
- pptx2markdown-0.2.0/src/pptx2markdown/shapes.py +244 -0
- pptx2markdown-0.2.0/src/pptx2markdown/smartart.py +74 -0
- pptx2markdown-0.2.0/src/pptx2markdown/snapshot.py +63 -0
- pptx2markdown-0.2.0/src/pptx2markdown/tables.py +264 -0
- pptx2markdown-0.2.0/src/pptx2markdown/vector.py +85 -0
- pptx2markdown-0.2.0/src/pptx2markdown/writer.py +257 -0
- pptx2markdown-0.1.2/PKG-INFO +0 -305
- pptx2markdown-0.1.2/README.ko.md +0 -272
- pptx2markdown-0.1.2/README.md +0 -274
- pptx2markdown-0.1.2/src/pptx2markdown/__init__.py +0 -13
- pptx2markdown-0.1.2/src/pptx2markdown/api.py +0 -73
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/__init__.py +0 -0
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/asset_utils.py +0 -215
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/converter_models.py +0 -324
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/embedded_attachments.py +0 -275
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/heading_rules.py +0 -80
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/package_inputs.py +0 -408
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/ppt_to_pptx.py +0 -254
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/run_pptx_to_markdown.py +0 -1675
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/slide_converter.py +0 -1122
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/structure_analysis_pipeline.py +0 -148
- pptx2markdown-0.1.2/src/pptx2markdown/main_converter/table_overlay.py +0 -522
- pptx2markdown-0.1.2/src/pptx2markdown/ooxml_security.py +0 -219
- pptx2markdown-0.1.2/src/pptx2markdown/pptx_inheritance/__init__.py +0 -25
- pptx2markdown-0.1.2/src/pptx2markdown/pptx_inheritance/resolver.py +0 -994
- pptx2markdown-0.1.2/src/pptx2markdown/presentation_document.schema.json +0 -122
- pptx2markdown-0.1.2/src/pptx2markdown/structure_analyzer/__init__.py +0 -1
- pptx2markdown-0.1.2/src/pptx2markdown/structure_analyzer/check_native_table_support.py +0 -335
- pptx2markdown-0.1.2/src/pptx2markdown/structure_analyzer/constants.py +0 -23
- pptx2markdown-0.1.2/src/pptx2markdown/structure_analyzer/extract_structure_analysis.py +0 -121
- pptx2markdown-0.1.2/src/pptx2markdown/structure_analyzer/extractor.py +0 -520
- pptx2markdown-0.1.2/src/pptx2markdown/structure_analyzer/pipeline.py +0 -521
- pptx2markdown-0.1.2/src/pptx2markdown/structure_analyzer/structure.py +0 -435
- pptx2markdown-0.1.2/src/pptx2markdown/structure_analyzer/text_rules.py +0 -60
- pptx2markdown-0.1.2/src/pptx2markdown/structure_analyzer/xml_primitives.py +0 -160
- pptx2markdown-0.1.2/src/pptx2markdown/table_pipeline/__init__.py +0 -7
- pptx2markdown-0.1.2/src/pptx2markdown/table_pipeline/parse.py +0 -193
- pptx2markdown-0.1.2/src/pptx2markdown/table_pipeline/render.py +0 -144
- pptx2markdown-0.1.2/src/pptx2markdown/table_pipeline/run.py +0 -298
- pptx2markdown-0.1.2/src/pptx2markdown/workspace_paths.py +0 -92
- {pptx2markdown-0.1.2 → pptx2markdown-0.2.0}/.gitignore +0 -0
- {pptx2markdown-0.1.2 → pptx2markdown-0.2.0}/LICENSE +0 -0
- {pptx2markdown-0.1.2 → pptx2markdown-0.2.0}/NOTICE +0 -0
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pptx2markdown
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Deterministic PPTX to Markdown, JSON and RAG chunks that reports its own uncertain decisions
|
|
5
|
+
Project-URL: Homepage, https://github.com/PPTX2Markdown/PPTX2Markdown
|
|
6
|
+
Project-URL: Repository, https://github.com/PPTX2Markdown/PPTX2Markdown
|
|
7
|
+
Project-URL: Issues, https://github.com/PPTX2Markdown/PPTX2Markdown/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Moonyoung Lee <happy518596@gmail.com>, Inseong Lee <sossos5989@naver.com>, Seung-Woo Jeong <zzs6348@gmail.com>
|
|
10
|
+
Maintainer-email: Moonyoung Lee <happy518596@gmail.com>, Inseong Lee <sossos5989@naver.com>, Seung-Woo Jeong <zzs6348@gmail.com>
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE
|
|
14
|
+
Keywords: converter,document-parsing,markdown,mcp,powerpoint,pptx,rag
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Office/Business :: Office Suites
|
|
23
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
24
|
+
Requires-Python: >=3.12
|
|
25
|
+
Requires-Dist: chart2md>=0.1.0
|
|
26
|
+
Requires-Dist: olefile>=0.47
|
|
27
|
+
Requires-Dist: omml2latex>=0.1.0
|
|
28
|
+
Requires-Dist: pydantic<3,>=2.10
|
|
29
|
+
Requires-Dist: smartart2md>=0.1.1
|
|
30
|
+
Provides-Extra: images
|
|
31
|
+
Requires-Dist: pillow>=10; extra == 'images'
|
|
32
|
+
Provides-Extra: mcp
|
|
33
|
+
Requires-Dist: mcp>=2.3; extra == 'mcp'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# pptx2markdown
|
|
37
|
+
|
|
38
|
+
[](https://github.com/PPTX2Markdown/PPTX2Markdown/actions/workflows/quality.yml)
|
|
39
|
+
[](https://pypi.org/project/pptx2markdown/)
|
|
40
|
+
[](https://pypi.org/project/pptx2markdown/)
|
|
41
|
+
[](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/LICENSE)
|
|
42
|
+
|
|
43
|
+
English | [한국어](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/README.ko.md)
|
|
44
|
+
|
|
45
|
+
`pptx2markdown` converts PowerPoint presentations into deterministic Markdown,
|
|
46
|
+
JSON or retrieval chunks. It reads the native OOXML structure and shape geometry
|
|
47
|
+
directly, never calls a model, and says where it is unsure: the decisions worth a
|
|
48
|
+
second look come with ready-made alternatives, so a person, a UI or a model can
|
|
49
|
+
settle them with a recipe that replays deterministically.
|
|
50
|
+
|
|
51
|
+
## Why pptx2markdown?
|
|
52
|
+
|
|
53
|
+
- **Reading order that follows the slide** — cards, labelled boxes and grouped
|
|
54
|
+
shapes are read as units and backgrounds are ignored; slides whose layout can be
|
|
55
|
+
read more than one way are flagged with the candidate orders.
|
|
56
|
+
- **Tables that keep their meaning** — the full cell grid with merge spans, merged
|
|
57
|
+
values repeated so every row stands alone, grouped two-row headers on request.
|
|
58
|
+
- **Decision points instead of silent guesses** — `review()` lists uncertain
|
|
59
|
+
choices with stable ids, reasons, what to look at and how much it matters;
|
|
60
|
+
answers become a recipe.
|
|
61
|
+
- **Nothing lost quietly** — `audit()` re-reads the slide XML and reports typed
|
|
62
|
+
text missing from the output.
|
|
63
|
+
- **Retrieval-ready** — slide-aligned chunks with citation metadata; parsing from
|
|
64
|
+
bytes or a stream; an MCP server for agents.
|
|
65
|
+
- **Rich native content** — text, headings, lists, tables, charts, SmartArt,
|
|
66
|
+
equations, images, speaker notes, sections and embedded attachments.
|
|
67
|
+
|
|
68
|
+
What each converter keeps of a deck, from the
|
|
69
|
+
[feature benchmark](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/benchmarks/README.md):
|
|
70
|
+
|
|
71
|
+
| | pptx2markdown | anydoc 0.2.5 | MarkItDown 0.1.9 |
|
|
72
|
+
| --- | :---: | :---: | :---: |
|
|
73
|
+
| Features kept (of 20) | **20** | 13 | 8 |
|
|
74
|
+
|
|
75
|
+
Upgrading from 0.1.x? The output, CLI flags and Python API changed; see the
|
|
76
|
+
[migration guide](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/docs/MIGRATION.md).
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
### Let an AI agent install it
|
|
81
|
+
|
|
82
|
+
A local coding agent can inspect the environment, choose an isolated install,
|
|
83
|
+
optionally configure LibreOffice, and verify the CLI. Give it this prompt and
|
|
84
|
+
review every permission request:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
Read https://raw.githubusercontent.com/PPTX2Markdown/PPTX2Markdown/main/.github/agent-install.md and install pptx2markdown for this machine. You may run the commands needed for installation after explaining them. Ask me before any administrator, sudo, password, system package-manager, shell-profile, PATH, or LibreOffice change.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
See the complete [agent installation procedure](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/.github/agent-install.md).
|
|
91
|
+
|
|
92
|
+
### Manual installation
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
uv tool install pptx2markdown
|
|
96
|
+
# or
|
|
97
|
+
pipx install pptx2markdown
|
|
98
|
+
# or, inside an active virtual environment
|
|
99
|
+
python -m pip install pptx2markdown
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Extras: `pptx2markdown[mcp]` (the MCP server) and `pptx2markdown[images]`
|
|
103
|
+
(trims EMF/WMF pictures drawn as PNG).
|
|
104
|
+
|
|
105
|
+
LibreOffice is optional. It is used only when asked for: `.ppt` input, EMF/WMF
|
|
106
|
+
pictures as PNG, and rendering the slides whose reading order is in question.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# macOS
|
|
110
|
+
brew install --cask libreoffice
|
|
111
|
+
|
|
112
|
+
# Ubuntu / Debian
|
|
113
|
+
sudo apt-get install libreoffice-impress
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Quick start
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# One file -> ./output/deck/deck.md
|
|
120
|
+
pptx2markdown deck.pptx
|
|
121
|
+
|
|
122
|
+
# Several files, a custom output root, one worker per CPU
|
|
123
|
+
pptx2markdown decks/*.pptx --output-dir converted --jobs 0
|
|
124
|
+
|
|
125
|
+
# Canonical JSON, or one JSON line per slide chunk
|
|
126
|
+
pptx2markdown deck.pptx --output-format json
|
|
127
|
+
pptx2markdown deck.pptx --output-format chunks
|
|
128
|
+
|
|
129
|
+
# What the converter was unsure about, and text it could not keep
|
|
130
|
+
pptx2markdown deck.pptx --review
|
|
131
|
+
pptx2markdown deck.pptx --audit
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Requirements
|
|
135
|
+
|
|
136
|
+
- Python 3.12 or later
|
|
137
|
+
- Pydantic 2.10 or later
|
|
138
|
+
- omml2latex 0.1.0 or later
|
|
139
|
+
- chart2md 0.1.0 or later
|
|
140
|
+
- smartart2md 0.1.1 or later
|
|
141
|
+
- olefile 0.47 or later
|
|
142
|
+
- local `.pptx` input; legacy `.ppt` only when asked for, through LibreOffice
|
|
143
|
+
|
|
144
|
+
There is no OCR, VLM, API key, cloud inference or PowerPoint automation in the
|
|
145
|
+
parsing path; models only ever see what you hand them. A `.ppt` file is converted
|
|
146
|
+
only with `ppt_converter="libreoffice"` (`--ppt-converter libreoffice`), which runs
|
|
147
|
+
LibreOffice headless in temporary directories that are removed afterwards
|
|
148
|
+
(`SOFFICE_PATH` selects the program). The same goes for `vector_images="png"`
|
|
149
|
+
(`--vector-images png`): EMF/WMF pictures, which browsers, Markdown viewers and
|
|
150
|
+
vision models cannot read, are drawn as PNG in one LibreOffice run and take the
|
|
151
|
+
original's place under the same asset id; with the `images` extra
|
|
152
|
+
(`pip install "pptx2markdown[images]"`) the page margin LibreOffice adds is trimmed.
|
|
153
|
+
|
|
154
|
+
## Python API
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
import pptx2markdown
|
|
158
|
+
|
|
159
|
+
with pptx2markdown.parse("deck.pptx") as presentation:
|
|
160
|
+
for slide in presentation.slides:
|
|
161
|
+
print(slide.page, slide.blocks)
|
|
162
|
+
|
|
163
|
+
result = presentation.save("output/deck")
|
|
164
|
+
print(result.document_path)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
`parse()` also takes the file's bytes or a binary stream, so an upload can be
|
|
168
|
+
converted without touching the disk (`name` is recorded as the source name):
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
with pptx2markdown.parse(request.files["deck"].stream, name="deck.pptx") as presentation:
|
|
172
|
+
markdown = presentation.render_markdown(assets="omit")
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
In-memory input is limited to `PackageLimits.max_package_bytes` (1 GiB).
|
|
176
|
+
|
|
177
|
+
`parse()` does not leave persistent output. Embedded payloads are kept in a
|
|
178
|
+
managed spooled store and no temporary path appears in the canonical model.
|
|
179
|
+
|
|
180
|
+
Markdown rendered without saving must receive an explicit asset policy:
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
with pptx2markdown.parse("deck.pptx") as presentation:
|
|
184
|
+
text_only = presentation.render_markdown(assets="omit")
|
|
185
|
+
|
|
186
|
+
web_markdown = presentation.render_markdown(
|
|
187
|
+
asset_url=lambda asset_id: f"/assets/{asset_id}",
|
|
188
|
+
)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Chunks for retrieval
|
|
192
|
+
|
|
193
|
+
`slide_chunks()` returns one chunk per slide with citation metadata (source,
|
|
194
|
+
page, slide and deck title, block ids, block kinds). A slide longer than
|
|
195
|
+
`max_chars` is split at block boundaries, never inside a table. Each chunk starts
|
|
196
|
+
with a comment naming the deck and slide, so a retrieved chunk keeps its context.
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
with pptx2markdown.parse("deck.pptx") as presentation:
|
|
200
|
+
for chunk in pptx2markdown.slide_chunks(presentation.document, max_chars=2000):
|
|
201
|
+
index.add(chunk.text, metadata=chunk.metadata)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`--output-format chunks` writes the same chunks as JSON lines
|
|
205
|
+
(`<deck>.chunks.jsonl`, `{"text": ..., "metadata": ...}` per line) with image
|
|
206
|
+
links into the bundle; `--max-chunk-chars` sets the split size.
|
|
207
|
+
|
|
208
|
+
### Recipes
|
|
209
|
+
|
|
210
|
+
A recipe adjusts a parsed document without touching the parser: document-wide
|
|
211
|
+
settings plus rules that select blocks or slides and say what to do with them.
|
|
212
|
+
It is plain data, so it can be stored next to a deck, reviewed, shared across a
|
|
213
|
+
team, or written by a language model from a request such as "drop the appendix
|
|
214
|
+
and treat the first two rows of the sales table as its header". Applying it is
|
|
215
|
+
deterministic.
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
recipe = pptx2markdown.Recipe(
|
|
219
|
+
merged_cells="blank",
|
|
220
|
+
rules=[
|
|
221
|
+
{"target": "slide[12-]", "exclude": True, "reason": "appendix"},
|
|
222
|
+
{"target": "slide[3]/table[0]", "header_rows": 2},
|
|
223
|
+
{"target": "s5.b2", "description": "Revenue by quarter, 2021-2024"},
|
|
224
|
+
{"target": "s1.b3", "heading_level": 2},
|
|
225
|
+
],
|
|
226
|
+
)
|
|
227
|
+
with pptx2markdown.parse("deck.pptx", recipe=recipe) as presentation:
|
|
228
|
+
...
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Every block has an id `s<page>.b<n>`; `render_markdown(block_ids=True)` shows
|
|
232
|
+
them as `<!-- s3.b2 table -->` comments so a reviewer or a model can point at
|
|
233
|
+
exact blocks, and `explain_recipe()` lists what each rule selects before it is
|
|
234
|
+
applied. Selectors:
|
|
235
|
+
|
|
236
|
+
| Selector | Selects |
|
|
237
|
+
| --- | --- |
|
|
238
|
+
| `s3.b2` | one block by id |
|
|
239
|
+
| `slide[3]`, `slide[2-5]`, `slide[12-]`, `slide[*]`, `slide[hidden]` | whole slides |
|
|
240
|
+
| `table`, `image`, `heading`, ... or `*` | every block of a kind |
|
|
241
|
+
| `table[0]`, `table[-1]` | the first or last block of a kind on each slide |
|
|
242
|
+
| `slide[3]/table[0]` | the first table on slide 3 |
|
|
243
|
+
| `section[Appendix]`, `section[Appendix]/image` | the slides (or blocks) of a PowerPoint section |
|
|
244
|
+
|
|
245
|
+
Settings: `merged_cells`, `include_notes`, `include_hidden`, and `headings`
|
|
246
|
+
(`placeholder` keeps only headings from title placeholders, like the legacy
|
|
247
|
+
converter's `--headings strict`).
|
|
248
|
+
|
|
249
|
+
Rule actions: `exclude`, `merged_cells`, `header_rows`, `caption_rows` (tables),
|
|
250
|
+
`heading_level` (set a heading's level or turn text into a heading), `as_text`
|
|
251
|
+
(headings and lists), `description` (image alt text), `notes` and `order`
|
|
252
|
+
(slide selectors: keep or drop notes; read the blocks in a given order of block
|
|
253
|
+
ids), and `reason`, which is kept for review only. Later rules win, and
|
|
254
|
+
every selector sees the document as parsed. `recipe_json_schema()` (or
|
|
255
|
+
`pptx2markdown --recipe-schema`) gives the JSON Schema for forms and structured
|
|
256
|
+
model output.
|
|
257
|
+
|
|
258
|
+
### Review
|
|
259
|
+
|
|
260
|
+
The converter always decides; `review()` points at the decisions most worth a
|
|
261
|
+
second look and offers each alternative as a ready-made recipe rule: a header
|
|
262
|
+
with merged groups whose next row looks like labels (two header rows?), a first
|
|
263
|
+
row that is all numbers (no header?), a merged first row taken as a table title,
|
|
264
|
+
an image with no description, a heading decided by font size alone (a
|
|
265
|
+
heading?), a short bold line that introduces a list or table (a
|
|
266
|
+
subheading?), or a slide whose layout can be read in more than one order. A
|
|
267
|
+
person, a UI or a language model only picks options, and the picks form a
|
|
268
|
+
recipe.
|
|
269
|
+
|
|
270
|
+
Reading order follows the slide's structure: groups and shapes that enclose
|
|
271
|
+
other shapes (a card's frame, a labelled box, a picture with callouts) are read
|
|
272
|
+
as units, and backgrounds covering the slide are ignored. Where the geometry
|
|
273
|
+
cannot settle the order (a grid that reads as well by rows as by columns, side
|
|
274
|
+
by side text with no gap between), the slide gets a `reading-order` review item
|
|
275
|
+
whose options are the candidate orders as `order` rules, so only those slides
|
|
276
|
+
need a person or a model to look at them. `choose_reading_orders_with(presentation,
|
|
277
|
+
judge)` renders just those slides as one-page PDFs (LibreOffice, locally) and asks
|
|
278
|
+
your `judge` function to name a candidate. See [the design](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/docs/reading_order_design.md).
|
|
279
|
+
|
|
280
|
+
Every item has the same shape whatever it is about, so a caller can plan
|
|
281
|
+
before it looks: a stable `id` (`table-header-rows@s3.b2`), machine-readable
|
|
282
|
+
`reasons` (`grouped-header`, `two-way-cut`, ...), the `page` and what to `look` at
|
|
283
|
+
to decide (`text`: the slide's Markdown is enough; `slide`: its rendering;
|
|
284
|
+
`image`: the picture, by `asset_id`), an `impact` (`high` when a wrong answer
|
|
285
|
+
corrupts content, `low` for formatting), options with stable ids (the first is
|
|
286
|
+
always `keep`) and the `suggested` one. `recipe_from_answers` turns
|
|
287
|
+
`{item id: option id}` into a recipe; an image description is answered with free
|
|
288
|
+
text. See [the contract](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/docs/agent_contract.md).
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
with pptx2markdown.parse("deck.pptx") as presentation:
|
|
292
|
+
items = presentation.review()
|
|
293
|
+
for item in items:
|
|
294
|
+
print(item.id, item.look, item.question, [option.id for option in item.options])
|
|
295
|
+
recipe = pptx2markdown.recipe_from_answers(
|
|
296
|
+
items, {"table-header-rows@s3.b2": "two-rows"}, unanswered="suggested"
|
|
297
|
+
)
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
`pptx2markdown deck.pptx --review` prints the same as JSON (with
|
|
301
|
+
`schema_version`) without writing bundles.
|
|
302
|
+
|
|
303
|
+
### Audit
|
|
304
|
+
|
|
305
|
+
A rule-based converter fails quietly: a shape it does not understand is simply
|
|
306
|
+
missing from the output. `audit()` reads the slide XML again, without the
|
|
307
|
+
parser's rules, and reports every piece of typed text that the document does not
|
|
308
|
+
contain, with its slide and shape id, plus slides missing from the document.
|
|
309
|
+
Text is compared as letters and digits, so escaping, emphasis, list markers and
|
|
310
|
+
line breaks never count as loss; footer, date and slide-number placeholders and
|
|
311
|
+
cells hidden by a merge are left out. Charts, SmartArt and equations are not
|
|
312
|
+
audited.
|
|
313
|
+
|
|
314
|
+
```python
|
|
315
|
+
with pptx2markdown.parse("deck.pptx") as presentation:
|
|
316
|
+
report = presentation.audit()
|
|
317
|
+
print(report.ok, report.coverage, report.losses)
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
`pptx2markdown deck.pptx --audit` prints the report as JSON without writing
|
|
321
|
+
bundles and exits with 1 when text was lost. Content removed by a recipe would
|
|
322
|
+
be reported too, so the CLI and MCP tool audit the conversion without one.
|
|
323
|
+
|
|
324
|
+
### Judging with a model
|
|
325
|
+
|
|
326
|
+
Nothing in the package calls a model. Where judgement helps, it hands a function
|
|
327
|
+
you supply exactly what that judgement needs and turns the answers into recipe
|
|
328
|
+
rules: `answer` review items with `recipe_from_answers`, describe pictures with
|
|
329
|
+
`describe_images_with`, pick reading orders with `choose_reading_orders_with`.
|
|
330
|
+
The function can be a person, a local model or a hosted one. Through the MCP
|
|
331
|
+
server below, the host model (Claude Code, for example) does the same with no API
|
|
332
|
+
key of its own. A multi-format agent can sit on top through
|
|
333
|
+
[the contract](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/docs/agent_contract.md).
|
|
334
|
+
|
|
335
|
+
Images can be described by any model, local or not, with nothing extra to install:
|
|
336
|
+
`describe_images_with` hands each picture that needs a description to a function
|
|
337
|
+
you supply, with the slide's Markdown for context, and returns a recipe. Nothing
|
|
338
|
+
leaves the machine unless that function sends it.
|
|
339
|
+
|
|
340
|
+
```python
|
|
341
|
+
from pptx2markdown import ImageDescription, describe_images_with
|
|
342
|
+
|
|
343
|
+
def describe(request): # request.data, .media_type, .alt_text, .slide_markdown
|
|
344
|
+
text = my_local_vision_model(request.data, context=request.slide_markdown)
|
|
345
|
+
return ImageDescription(description=text)
|
|
346
|
+
|
|
347
|
+
with pptx2markdown.parse("deck.pptx") as presentation:
|
|
348
|
+
presentation.apply(describe_images_with(presentation, describe))
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### MCP server
|
|
352
|
+
|
|
353
|
+
`pip install "pptx2markdown[mcp]"` adds `pptx2markdown-mcp`, a Model Context
|
|
354
|
+
Protocol server (stdio) so an agent such as Claude can run the recipe workflow
|
|
355
|
+
itself: `convert_presentation` (Markdown with block ids, optionally with a
|
|
356
|
+
recipe applied, or only some `pages`), `review_presentation` (filterable by
|
|
357
|
+
topic, look, impact and page), `answers_to_recipe` (review answers
|
|
358
|
+
to a recipe), `audit_presentation` (text the
|
|
359
|
+
conversion lost), `presentation_images` (pictures without a description, as
|
|
360
|
+
images, so the host model can describe them in a recipe), `presentation_slides`
|
|
361
|
+
(the slides whose reading order is in question, rendered locally by LibreOffice,
|
|
362
|
+
so the host model can pick the order), `check_recipe` (what
|
|
363
|
+
each rule selects), `presentation_chunks` and `recipe_schema`. Two prompts
|
|
364
|
+
walk a host model through the workflow: `prepare_for_retrieval` (audit, answer the
|
|
365
|
+
review, describe pictures, check the recipe, chunk) and `apply_request` (turn a
|
|
366
|
+
plain-language request into a checked recipe). It reads local `.pptx` files and
|
|
367
|
+
writes nothing.
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
claude mcp add pptx2markdown -- pptx2markdown-mcp
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
or, in an MCP client configuration:
|
|
374
|
+
|
|
375
|
+
```json
|
|
376
|
+
{"mcpServers": {"pptx2markdown": {"command": "pptx2markdown-mcp"}}}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Use `convert()` for parse-and-save:
|
|
380
|
+
|
|
381
|
+
```python
|
|
382
|
+
result = pptx2markdown.convert(
|
|
383
|
+
"deck.pptx",
|
|
384
|
+
output_dir="output",
|
|
385
|
+
)
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
## CLI
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
pptx2markdown deck.pptx
|
|
392
|
+
pptx2markdown first.pptx second.pptx --output-dir converted
|
|
393
|
+
pptx2markdown decks/*.pptx --jobs 0 # one worker process per CPU
|
|
394
|
+
pptx2markdown deck.pptx --output-format json
|
|
395
|
+
pptx2markdown deck.pptx --output-format chunks --max-chunk-chars 2000
|
|
396
|
+
pptx2markdown deck.pptx --merged-cells blank
|
|
397
|
+
pptx2markdown deck.pptx --recipe recipe.json
|
|
398
|
+
pptx2markdown --recipe-schema
|
|
399
|
+
pptx2markdown deck.pptx --review
|
|
400
|
+
pptx2markdown deck.pptx --audit
|
|
401
|
+
pptx2markdown old-deck.ppt --ppt-converter libreoffice --vector-images png
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
PowerPoint's lock files (`~$deck.pptx`, written while a deck is open) are skipped
|
|
405
|
+
with a warning, so a glob such as `decks/*.pptx` does not fail on them.
|
|
406
|
+
|
|
407
|
+
Default bundle:
|
|
408
|
+
|
|
409
|
+
```text
|
|
410
|
+
output/
|
|
411
|
+
└── deck/
|
|
412
|
+
├── deck.md
|
|
413
|
+
├── media/
|
|
414
|
+
├── attachments/
|
|
415
|
+
└── bundle-manifest.json
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Markdown links are relative to `deck.md`, so the whole `deck/` directory can be
|
|
419
|
+
moved without breaking embedded assets.
|
|
420
|
+
|
|
421
|
+
## Supported static content
|
|
422
|
+
|
|
423
|
+
- slide order and hidden-slide metadata
|
|
424
|
+
- geometry-only reading order by recursive XY-cut: columns separated by a vertical
|
|
425
|
+
gap are read one after another, a full-width title or divider is read before
|
|
426
|
+
the columns below it, a stack of slightly offset boxes stays top to bottom, an
|
|
427
|
+
overlap of up to one pixel still counts as a gap, and background frames and
|
|
428
|
+
footers cannot seal a column gap
|
|
429
|
+
- headings from title/subtitle placeholders, section numbering and font size;
|
|
430
|
+
each heading records its `source` (`placeholder`, `position`, `numbering`,
|
|
431
|
+
`text` or `font`) so the weakest decisions can be reviewed or dropped
|
|
432
|
+
- placeholder type, position, font size and bullets inherited from the slide
|
|
433
|
+
layout and master; footer placeholders are dropped
|
|
434
|
+
- text shapes and pictures drawn from the slide layout and master (blocks keep
|
|
435
|
+
`source_part`; thin lines and bands are decoration; the recipe setting
|
|
436
|
+
`template_pictures: false` leaves repeated logos out)
|
|
437
|
+
- text, hyperlinks and lists; consecutive plain paragraphs of a shape form one
|
|
438
|
+
text block (one line each) and consecutive bullets one list, while text, lists
|
|
439
|
+
and equations in the same shape stay separate typed blocks; a typed `▶` starts
|
|
440
|
+
a list item, and a paragraph indented with typed spaces right after an item
|
|
441
|
+
continues it
|
|
442
|
+
- bold and italic runs as `**bold**`/`*italic*` when they emphasise part of the
|
|
443
|
+
text; bold over a whole table cell or a whole multi-line text box is styling
|
|
444
|
+
and is left out, and emphasis a renderer could not show is dropped; text, heading and list `text`
|
|
445
|
+
is escaped inline Markdown, so typed `# x`, `- x`, `<tag>` or `[x](y)` render
|
|
446
|
+
literally instead of becoming a heading, list, HTML or link
|
|
447
|
+
- equations (OMML) as LaTeX via omml2latex
|
|
448
|
+
- embedded images, including shapes filled with a picture
|
|
449
|
+
- embedded audio/video payloads
|
|
450
|
+
- OLE, 3D model, audio and video attachments, labelled by file name; an OLE
|
|
451
|
+
compound file is unpacked to the file inside it (the Packager's original file
|
|
452
|
+
or the server's document stream) and its ProgID is kept as `program`
|
|
453
|
+
- native tables: JSON keeps the full grid (`rows`, with each merge's text,
|
|
454
|
+
`row_span`/`col_span`, and `merged_from` on the cells it covers) next to the
|
|
455
|
+
rendered `markdown`; the first row is the header and an empty header becomes
|
|
456
|
+
`col_N`; `merged_cells` decides what a covered cell shows (`fill`, the
|
|
457
|
+
default, repeats the merged value so every row stands alone for retrieval;
|
|
458
|
+
`header` repeats it only in the header row; `blank`
|
|
459
|
+
never); a first row merged across the whole table is a title written once
|
|
460
|
+
above it (`caption_rows`); bullets, numbering and links inside cells
|
|
461
|
+
are kept, and pictures lying on a cell or filling its background are written
|
|
462
|
+
into that cell
|
|
463
|
+
- charts via chart2md: classic charts from their cached values, Office 2016
|
|
464
|
+
chartEx charts (funnel, waterfall, ...) from their embedded workbook, which is
|
|
465
|
+
checked like the package itself and falls back to cached values when rejected
|
|
466
|
+
- SmartArt via smartart2md: hierarchies as indented lists, process and cycle
|
|
467
|
+
layouts as numbered steps, matrices as tables and pictures as images; a
|
|
468
|
+
diagram whose nodes have no text is counted as `[smartart: N unlabeled nodes]`
|
|
469
|
+
- speaker notes
|
|
470
|
+
- grouped shapes and Markup Compatibility `AlternateContent`
|
|
471
|
+
|
|
472
|
+
Unsupported or unavailable content produces a structured warning or an
|
|
473
|
+
`UnsupportedBlock`; it is not silently treated as successfully converted.
|
|
474
|
+
|
|
475
|
+
OCR and tables drawn from the layout or master are not supported;
|
|
476
|
+
image descriptions come from a describer you supply.
|
|
477
|
+
|
|
478
|
+
## Development
|
|
479
|
+
|
|
480
|
+
```bash
|
|
481
|
+
python -m pip install -e ".[mcp]"
|
|
482
|
+
python -m unittest discover -v
|
|
483
|
+
python scripts/update_goldens.py --check
|
|
484
|
+
ruff check src tests scripts benchmarks
|
|
485
|
+
ruff format --check src tests scripts benchmarks
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
When conversion output changes on purpose, review the diff of the golden
|
|
489
|
+
snapshots before accepting them with `python scripts/update_goldens.py --accept`.
|
|
490
|
+
|
|
491
|
+
Coming from 0.1.x? See [the migration guide](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/docs/MIGRATION.md).
|
|
492
|
+
|
|
493
|
+
See [ARCHITECTURE.md](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/docs/ARCHITECTURE.md) for ownership, lifecycle and security
|
|
494
|
+
details.
|
|
495
|
+
|
|
496
|
+
## License
|
|
497
|
+
|
|
498
|
+
Copyright 2026 Moonyoung Lee, Inseong Lee, Seung-Woo Jeong
|
|
499
|
+
|
|
500
|
+
The project is distributed under the [Apache License 2.0](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/LICENSE).
|
|
501
|
+
Third-party golden fixture attribution is recorded in
|
|
502
|
+
[`THIRD_PARTY_NOTICES.md`](https://github.com/PPTX2Markdown/PPTX2Markdown/blob/main/tests/fixtures/golden/THIRD_PARTY_NOTICES.md).
|