brewdoc-linux-x64-glibc 0.3.1 → 0.3.3

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.
package/README.md CHANGED
@@ -3,381 +3,134 @@
3
3
  [![PyPI](https://img.shields.io/pypi/v/brewdoc)](https://pypi.org/project/brewdoc/)
4
4
  [![CI](https://github.com/kochetkov-ma/brewdoc/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/kochetkov-ma/brewdoc/actions/workflows/ci.yml)
5
5
  [![Release](https://img.shields.io/github/v/release/kochetkov-ma/brewdoc)](https://github.com/kochetkov-ma/brewdoc/releases/latest)
6
- [![MIT](https://img.shields.io/github/license/kochetkov-ma/brewdoc)](LICENSE)
6
+ [![MIT](https://img.shields.io/github/license/kochetkov-ma/brewdoc)](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/LICENSE)
7
7
 
8
- Document to Markdown for agent systems: PDF, Word, PPTX presentations, spreadsheets, EPUB and static
9
- HTML in, one Markdown file plus a JSON receipt out. No models or OCR. Local conversion
10
- is offline and deterministic (same file, same bytes). Explicit `--url` acquires a page.
11
- The receipt says what was rendered,
12
- what was dropped and what the route structurally cannot carry.
8
+ Fast, deterministic document-to-Markdown conversion for agent systems. Easy to install. No model weights, OCR or external services.
13
9
 
14
- ## Install
15
-
16
- Choose one method. [Latest release](https://github.com/kochetkov-ma/brewdoc/releases/latest)
17
- contains its complete installation guide. Python releases 0.2.0 and 0.3.0 are public.
18
- These commands select 0.3.1 and apply when that version is published; its
19
- [release guide](https://github.com/kochetkov-ma/brewdoc/releases/tag/v0.3.1)
20
- records accepted channels. Badges show published versions and main CI, not universal OS support.
10
+ Local conversion runs offline after installation, with no runtime component downloads.
11
+ Supported documents become one Markdown file and a JSON receipt describing omissions.
12
+ See [supported formats and limits](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/FORMATS.md).
21
13
 
22
- | channel | command |
23
- |---|---|
24
- | pip | `python -m pip install "brewdoc==0.3.1"` in a dedicated virtual environment |
25
- | uvx, temporary | `uvx --python 3.12 --from "brewdoc==0.3.1" brewdoc file.pdf --out file.md` |
26
- | uv tool, installed | `uv tool install --python 3.12 "brewdoc==0.3.1"` |
27
- | pipx, installed | `pipx install --python 3.12 "brewdoc==0.3.1"` |
28
- | Container recipe (pip) | `RUN pip install brewdoc==0.3.1` |
14
+ ## Install
29
15
 
30
- pip needs an installed Python 3.12. Use explicit environment paths without activation.
31
- Linux/macOS:
16
+ These examples select 0.3.3. Use a channel listed as available in [that release](https://github.com/kochetkov-ma/brewdoc/releases/tag/v0.3.3). Choose one method:
32
17
 
33
18
  ```sh
34
- python3.12 -m venv .venv
35
- .venv/bin/python -m pip install "brewdoc==0.3.1"
36
- .venv/bin/python -c "from importlib.metadata import version; print(version('brewdoc'))"
37
- .venv/bin/brewdoc --self-check
38
- .venv/bin/brewdoc file.pdf --out file.md
39
- ```
40
-
41
- Windows PowerShell:
42
-
43
- ```powershell
44
- py -3.12 -m venv .venv
45
- .\.venv\Scripts\python.exe -m pip install "brewdoc==0.3.1"
46
- .\.venv\Scripts\python.exe -c "from importlib.metadata import version; print(version('brewdoc'))"
47
- .\.venv\Scripts\brewdoc.exe --self-check
48
- .\.venv\Scripts\brewdoc.exe file.pdf --out file.md
19
+ python -m pip install "brewdoc==0.3.3"
20
+ uv tool install --python 3.12 "brewdoc==0.3.3"
21
+ pipx install --python 3.12 "brewdoc==0.3.3"
49
22
  ```
50
23
 
51
- uv and pipx must already be installed. After installation, run `uv tool update-shell`
52
- or `pipx ensurepath`, open a new terminal, then run `brewdoc --self-check` and
53
- `brewdoc file.pdf --out file.md`. `uv tool list` or `pipx list` shows the managed version.
54
- Check PATH selection with `command -v brewdoc` on Unix or `Get-Command brewdoc` in PowerShell.
55
-
56
- For an exact published version X.Y.Z, update with the environment's Python and
57
- `-m pip install --upgrade "brewdoc==X.Y.Z"`,
58
- `uv tool install --force --python 3.12 "brewdoc==X.Y.Z"` or
59
- `pipx install --force --python 3.12 "brewdoc==X.Y.Z"`. Replace X.Y.Z before running.
60
- Remove with the same Python's `-m pip uninstall brewdoc`, `uv tool uninstall brewdoc`
61
- or `pipx uninstall brewdoc`. pip leaves dependencies; remove the dedicated virtual
62
- environment when no longer needed. uvx uses temporary cached environments, adds no
63
- persistent PATH command and needs no tool uninstall. Choose another exact version to update.
64
-
65
- ### Standalone and npm
66
-
67
- The links and commands below work when the named release is published and its
68
- native/public consumer checks pass. Check the
69
- [release guide](https://github.com/kochetkov-ma/brewdoc/releases/tag/v0.3.1)
70
- for that version's accepted channels and targets. Download badges select assets;
71
- they do not establish runtime acceptance. The npm badge shows the registry version.
72
- Existing 0.2.0/0.3.0 releases contain Python wheel/sdist archives only.
24
+ Use a virtual environment for pip. Python 3.12+ is required; HTML/URL need CPython 3.12-3.14.
25
+ [INSTALL.md](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/INSTALL.md) covers prerequisites, Windows, uvx, PATH, update and removal.
26
+ [Latest release](https://github.com/kochetkov-ma/brewdoc/releases/latest) lists actual assets and channel availability.
73
27
 
74
- [![npm](https://img.shields.io/npm/v/brewdoc)](https://www.npmjs.com/package/brewdoc)
75
- [![Linux x64 download](https://img.shields.io/badge/Linux_x64-download-blue)](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.1/brewdoc-0.3.1-linux-x64.tar.gz)
76
- [![Windows x64 download](https://img.shields.io/badge/Windows_x64-download-blue)](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.1/brewdoc-0.3.1-windows-x64.zip)
77
- [![macOS ARM64 download](https://img.shields.io/badge/macOS_ARM64-download-blue)](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.1/brewdoc-0.3.1-macos-arm64.tar.gz)
78
-
79
- | Native target | Version-specific download | Verification target | JavaScript |
80
- |---|---|---|---|
81
- | Linux x86_64, glibc | [Linux archive](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.1/brewdoc-0.3.1-linux-x64.tar.gz) | Ubuntu 22.04, glibc 2.35 | Bundled; requires target acceptance |
82
- | Windows x86_64 | [Windows archive](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.1/brewdoc-0.3.1-windows-x64.zip) | Windows Server 2025 | Refused before requests |
83
- | macOS ARM64 | [macOS archive](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.1/brewdoc-0.3.1-macos-arm64.tar.gz) | macOS 15, Apple Silicon | Bundled; requires target acceptance |
84
-
85
- Download [SHA256SUMS](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.1/SHA256SUMS)
86
- beside the archive. Compare its SHA-256 before extraction with `sha256sum ARCHIVE`
87
- on Linux, `shasum -a 256 ARCHIVE` on macOS or `Get-FileHash ARCHIVE -Algorithm SHA256`
88
- in PowerShell. Keep the complete brewdoc directory, including _internal and licenses.
89
- Read brewdoc/version.json for version/source/target, then run
90
- `./brewdoc/brewdoc --self-check` or `.\brewdoc\brewdoc.exe --self-check` and use that
91
- executable with `file.pdf --out file.md`. Add its absolute directory to your shell
92
- profile or Windows user PATH for persistent use. Update by verifying and extracting
93
- a fresh complete release directory, self-checking it, then repointing PATH. Remove
94
- the dedicated directory and PATH entry to uninstall. Full download/extraction commands
95
- are in the generated guide attached to the published release.
96
-
97
- Verification targets do not establish older OS support. Linux musl/ARM64 and macOS
98
- Intel are outside this initial binary set. Windows is unsigned; macOS uses an ad hoc
99
- build signature without Developer ID/notarization. Linux uses checksums without a
100
- detached publisher signature. OS policy may prevent launch.
101
-
102
- npm requires Node 24.21.0/npm 12.2.0 for the tested flow; Python is bundled on admitted
103
- targets. Once this exact npm release is publicly verified:
104
-
105
- ```sh
106
- npm install --global brewdoc@0.3.1
107
- npm list --global brewdoc --depth=0
108
- brewdoc --self-check
109
- brewdoc file.pdf --out file.md
110
- ```
28
+ ### Standalone downloads
111
29
 
112
- Temporary cached invocation:
30
+ Use downloads listed as available in the release. Python and dependencies are bundled. Verify [SHA256SUMS](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.3/SHA256SUMS) and keep the entire extracted directory.
113
31
 
114
- ```sh
115
- npx --yes --package brewdoc@0.3.1 brewdoc --self-check
116
- npx --yes --package brewdoc@0.3.1 brewdoc file.pdf --out file.md
117
- ```
32
+ [![Linux x64 download](https://img.shields.io/badge/Linux_x64-download-blue)](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.3/brewdoc-0.3.3-linux-x64.tar.gz)
33
+ [![Windows x64 download](https://img.shields.io/badge/Windows_x64-download-blue)](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.3/brewdoc-0.3.3-windows-x64.zip)
34
+ [![macOS ARM64 download](https://img.shields.io/badge/macOS_ARM64-download-blue)](https://github.com/kochetkov-ma/brewdoc/releases/download/v0.3.3/brewdoc-0.3.3-macos-arm64.tar.gz)
118
35
 
119
- Update with `npm install --global brewdoc@X.Y.Z` for an exact published version;
120
- remove with `npm uninstall --global brewdoc`. npx installs no persistent global tool;
121
- choose another exact version to update. Keep optional platform packages enabled.
122
- Missing packages or unsupported platforms refuse. The launcher adds no runtime downloads.
36
+ | Native target | Verification environment | JavaScript |
37
+ |---|---|---|
38
+ | Linux x64/glibc | Ubuntu 22.04, glibc 2.35 | Bundled |
39
+ | Windows x64 | Windows Server 2025 | Refused before requests |
40
+ | macOS ARM64 | macOS 15, Apple Silicon | Bundled |
123
41
 
124
- Python package installations require Python >= 3.12. Base runtime dependencies: `pdfplumber` (pulls pypdfium2, Pillow,
125
- cryptography) and `python-calamine`. HTML requires CPython 3.12-3.14 and the native Lexbor
126
- parser from this exact conditional dependency:
42
+ Older OSes, Linux musl/ARM64 and macOS Intel are outside this binary set.
43
+ Windows is unsigned; macOS has an ad hoc signature without Developer ID/notarization.
44
+ Linux archives have checksums, without a detached publisher signature. [Download and launch](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/INSTALL.md#standalone).
127
45
 
128
- ```text
129
- selectolax==0.4.13; python_version < '3.15' and platform_python_implementation == 'CPython'
130
- ```
46
+ ### npm
131
47
 
132
- Other runtimes retain the `.html` route and Python API but explicitly refuse HTML. On supported
133
- CPython, a missing or broken parser is an environment failure and `--self-check` exits 1.
134
- On an unsupported HTML runtime, self-check verifies HTML refusal and checks all other formats.
48
+ [![npm](https://img.shields.io/npm/v/brewdoc)](https://www.npmjs.com/package/brewdoc)
135
49
 
136
- Version 0.3.0 includes URL acquisition and optional JavaScript capture.
137
- Install the extra with `python -m pip install 'brewdoc[render-js]==0.3.1'`. It uses QuickJS-ng 0.17.0.1
138
- and bundled LinkeDOM 0.18.13. From this source checkout, install the locked extra
139
- with `uv sync --locked --extra render-js`. Run it with
140
- `uv run --locked --extra render-js brewdoc --url URL --render-js`.
141
- Python and standalone invocations need no Node or browser engine. npm/npx use Node
142
- as a launcher; no invocation downloads runtime components.
50
+ npm targets Linux x64/glibc and macOS ARM64. Windows uses the GitHub native download or Python package.
51
+ Use npm/npx only when listed as available in [the release](https://github.com/kochetkov-ma/brewdoc/releases/tag/v0.3.3).
52
+ [INSTALL.md](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/INSTALL.md#npm-and-npx) contains exact-version installation, update and removal instructions.
143
53
 
144
54
  ## Usage
145
55
 
146
- ```
56
+ ```sh
147
57
  brewdoc file.pdf --out file.md
148
- brewdoc slides.pptx --out slides.md
149
58
  brewdoc book.epub --out book.md
150
- brewdoc page.html --out page.md
151
- brewdoc --url https://example.com/article --out article.md
152
- brewdoc --url https://example.com/article --render-js --timeout 30 --out article.md
153
- brewdoc file.xlsx # no --out: receipt line, then the Markdown, on stdout
154
- brewdoc file.xlsx --sheet Calc --sheet Inputs
59
+ brewdoc file.xlsx --sheet Calc --sheet Inputs --out book.md
155
60
  brewdoc file.xlsm --artifact formula/sheet/000002=formulas.json
156
61
  brewdoc file.xlsm --artifact vba/project/000001=vbaProject.bin
157
- brewdoc --self-check # renders synthetic fixtures twice, compares sha256, exit 0 when green
62
+ brewdoc --self-check
158
63
  ```
159
64
 
160
- `--sheet` is repeatable. Names are exact and case-sensitive. Output follows caller order while
161
- keeping each sheet's full-workbook ordinal. `--artifact` is also repeatable. Use keys listed in the
162
- Markdown artifact table. Both options are workbook-only. brewdoc validates every request and
163
- output collision before writing.
164
-
165
- URL mode accepts one public HTTP(S) HTML page with strict UTF-8 decoding. Initial
166
- page acquisition uses GET, verified TLS and default ports only. Private destinations, URL credentials
167
- and HTTPS downgrades are refused; proxy environment settings are ignored. Each redirect and
168
- resource is validated. Acquisition allows at most five redirects and an 8 MiB
169
- body limit. `--timeout SECONDS` sets one maximum waiting budget for loading and
170
- optional JS, default 30 seconds. It accepts positive finite seconds within the
171
- supported clock range and returns earlier when ready. Increase it for pages
172
- that need longer loading or JS waiting.
173
- Bounded cleanup and local conversion can add time after waiting ends.
174
- No login, cookie profile or bot bypass is offered.
175
- Local files and default static URL capture do not execute JavaScript.
176
-
177
- `--render-js` explicitly executes the selected page's scripts locally in a separate
178
- process with bounded APIs and resources. No filesystem or shell APIs are exposed,
179
- and captures do not reuse browser state. This is not a general operating-system
180
- security sandbox. It supports DOM mutations, bounded jobs/timers and guarded GET
181
- requests. Async XHR also supports the public Algolia search endpoint used by
182
- hn.algolia.com, with its original string body and no cookies or user credentials.
183
- Other POST requests remain unsupported; search redirects are refused without replay.
184
- Supported module loading uses the native engine. Temporary `localStorage`
185
- starts empty for each capture; accessing it marks the result partial.
186
- Each capture starts with a writable `innerWidth` of 1024 CSS pixels.
187
- Width changes stay within that capture.
188
- It does not provide browser layout, iframe execution,
189
- workers, WebSockets, media or browser-wide compatibility. Native JS requires a
190
- verified QuickJS public ABI on macOS ARM64 or 64-bit glibc Linux (x86_64/aarch64).
191
- Windows, macOS Intel, musl Linux and 32-bit systems refuse JS. Missing components or unsupported
192
- runtimes refuse before fetching.
193
- See [URL acquisition limits](FORMATS.md#url-acquisition).
194
-
195
- URL receipts use `brewdoc.receipt/2` with redacted acquisition provenance and the
196
- frozen snapshot identity. Timing-only expiry preserves available valid content
197
- with `acquisition.capture_status=partial` and a diagnostic.
198
- The receipt distinguishes the current DOM from an explicitly marked fallback to
199
- the already acquired original HTML, where JS completion is unknown. No HTML is
200
- returned from an incomplete response. Hard network, security, heap, native fault,
201
- tamper or resource failures exit 1 and preserve an existing output file.
202
- Exit 0 confirms conversion, not script completion or article fidelity.
203
- Live acquisition can change; conversion of the same frozen snapshot remains
204
- deterministic. No 90% coverage or
205
- global JavaScript compatibility is claimed.
206
-
207
- Combining `--url` with a local path or `--self-check`, or using `--render-js` without
208
- `--url`, exits 2 before acquisition. Invalid timeout values and an explicit
209
- `--timeout` without `--url` also exit 2. URL requests with `--sheet` or `--artifact`
210
- exit 1 with an HTML refusal receipt before HTTP.
211
-
212
- Every successful document uses `brewdoc.markdown/2`. A quoted source title is followed by Metadata,
213
- Artifacts, Known omissions, Contents, then anchored content units. PDF keys are `page/000001`,
214
- workbook keys are `sheet/000001`, DOCX keys are `chapter/000001`, PPTX keys are `slide/000001`,
215
- EPUB keys follow declared spine ordinals as `chapter/000001`, and HTML has one `chapter/000001`.
216
- Metadata contains deterministic source identity, selection, content hashes, conversion tallies, and
217
- artifact capabilities. It excludes paths, timestamps, permissions, host data, and unsupported author
218
- metadata. EPUB adds source-declared publication titles, creators, languages and identifiers.
219
-
220
- For a conversion request, one JSON receipt line goes to stdout first (wrapped here, `unit_keys` omitted):
221
-
222
- ```json
223
- {"artifacts": [], "broken_ligature_words": 0, "columns_split": 1,
224
- "dropped": {"cid_survivors": 0, "control_chars": 0, "ligatures": 0, "nbsp": 0,
225
- "non_ascii_replaced": 0, "page_numbers": 3, "pua_glyphs": 0,
226
- "running_heads": 0, "soft_hyphens": 0},
227
- "file_ok": true, "markdown_schema": "brewdoc.markdown/2",
228
- "not_carried": ["images, figures and the text drawn inside them",
229
- "a table that spans a page break",
230
- "text rotated out of the horizontal reading order"],
231
- "out": "file.md",
232
- "reason": "pdf rendered: 7 pages, 1 tables, 26 text regions, 1 column splits",
233
- "receipt_schema": "brewdoc.receipt/1",
234
- "route": "pdf", "source": "nist-sp800-145.pdf", "tables": 1,
235
- "text_regions": 26, "unit_kind": "page", "units": 7}
236
- ```
65
+ `--sheet` and `--artifact` are repeatable and workbook-only. Sheet names are exact and case-sensitive;
66
+ caller order retains full-workbook ordinals. Artifact keys come from the Markdown artifact table.
67
+ Requests and output collisions are validated before writes. Paths resolve against the caller's directory;
68
+ `--out` creates parents. Refusal preserves existing output. Self-check is offline and has its own output.
69
+
70
+ ## Markdown and receipts
237
71
 
238
- | key | meaning |
72
+ Successful output uses `brewdoc.markdown/2`: quoted source title, Metadata, Artifacts,
73
+ Known omissions, Contents, then anchored units. PDF uses `page/000001`, workbooks `sheet/000001`,
74
+ PPTX `slide/000001`, and DOCX/EPUB/HTML `chapter/000001`. Empty declared units remain navigable.
75
+ Metadata holds source/selection/content hashes, conversion tallies and artifact capabilities;
76
+ it excludes paths, timestamps, permissions and host data. EPUB retains declared publication metadata.
77
+
78
+ Conversion prints one JSON receipt line first. With `--out`, Markdown goes to the file;
79
+ without it, Markdown follows on stdout. Local receipts use `brewdoc.receipt/1`; URL receipts use `brewdoc.receipt/2`.
80
+
81
+ | Receipt fields | Meaning |
239
82
  |---|---|
240
- | `file_ok`, `reason` | `false` when the file was refused (no text layer, unreadable, unsupported suffix); `reason` names why, or summarises what was rendered |
241
- | `route` | which reader ran: `pdf`, `doc`, `presentation`, `sheet`, `epub` or `html` |
242
- | `source` | the local filename, or the redacted requested URL in URL mode |
243
- | `unit_kind`, `units` | the route's content unit and how many were rendered; one pair for every format. `page` for PDF, `chapter` for DOCX, EPUB and HTML, `slide` for PPTX, `sheet` for a workbook, and `none` on a suffix brewdoc does not read |
244
- | `tables`, `text_regions`, `columns_split` | what else was rendered |
245
- | `receipt_schema` | the receipt key contract; `brewdoc.receipt/1` replaced the per-format `pages` and `sheets` counters |
246
- | `broken_ligature_words` | words with a ligature the font mapped to a stray code point, folded to ASCII, not repaired |
247
- | `dropped` | sanitised items removed on purpose, counted by kind (running heads, page numbers, ...) |
248
- | `not_carried` | what this route structurally cannot represent - read it before concluding a fact is absent |
249
- | `out` | the Markdown path, or `null` when it went to stdout |
250
- | `markdown_schema`, `unit_keys` | the contract and ordered full-source content keys; success only |
251
- | `artifacts` | available keyed formula or opaque VBA outputs and requested output paths; success only |
252
- | `selected_sheets` | the `--sheet` names in caller order; present only when sheets were selected |
253
-
254
- Paths resolve against the current working directory; `--out` creates parent directories.
255
- Exit code is non-zero on refusal; the receipt line is still printed.
256
-
257
- ## Formats
258
-
259
- | in | reader | notes |
260
- |---|---|---|
261
- | `.pdf` | pdfplumber | needs a text layer; route chosen per region, never per page |
262
- | `.docx` | stdlib zip + XML | paragraphs and tables |
263
- | `.pptx` | stdlib zip + XML | slides in declared order; text, tables, notes and picture metadata |
264
- | `.epub` | stdlib zip + XML | EPUB 2/3 static XHTML in declared spine order; Unicode metadata and navigation |
265
- | `.xlsx` `.xlsm` `.xls` `.xlsb` `.ods` | python-calamine | selected sheets keep full-source ordinals; numbers as stored (`85.0`), dates as ISO days |
266
- | `.html` | selectolax Lexbor | full static body or fragment, complete tables and source-declared controls; CPython 3.12-3.14 |
267
-
268
- `.xlsx` and `.xlsm` expose original OOXML formulas as one deterministic JSON artifact per
269
- formula-bearing selected sheet. Markdown still contains cached values. `.xlsm` and `.xlsb` can expose
270
- one complete related `vbaProject.bin` as opaque bytes. brewdoc does not execute macros, decompile VBA,
271
- report source-module counts, evaluate formulas, or infer dependency graphs.
272
-
273
- HTML reads local strict UTF-8, with an optional BOM. It preserves meaningful Unicode, navigation,
274
- main content, sidebars and footers in recovered DOM order. It never fetches links or resources,
275
- executes scripts, submits forms or infers interactive values. Links use a restricted scheme policy;
276
- form actions remain inert metadata. Inline code outside tables becomes a literal fenced block;
277
- surrounding emphasis and links remain balanced. Safe links in literal code and around code/images
278
- retain destination records without changing the source literals. Table-cell code uses labelled
279
- escaped text. Quotes and list items containing standalone child blocks use explicit nesting
280
- boundaries in place of visual Markdown
281
- containers. Plain list paragraphs retain their item marker and continuation indentation.
282
- See [HTML scope and limits](FORMATS.md#static-html).
283
-
284
- EPUB reads one package with static XHTML in EPUB 2 or 3. Each declared spine item becomes
285
- a chapter, including empty and non-linear items, front matter and back matter. Publication
286
- navigation retains source hierarchy and links to generated chapter and fragment anchors.
287
- Declared metadata and meaningful Unicode are preserved. Images remain inert alt/title/target
288
- records; no pixels or external resources are read. EPUB adds no parser dependency.
289
- Malformed required content, unsafe archives, unavailable navigation targets, encrypted reading
290
- text, declared fixed layout and unsupported required media without an XHTML fallback refuse
291
- the whole book before output writes. Multiple rootfiles are outside this supported profile.
292
- See [EPUB scope and limits](FORMATS.md#epub).
293
-
294
- The public Python API exposes EPUB, HTML and presentation rendering and generic workbook artifact access:
83
+ | `file_ok`, `reason` | Conversion success or named refusal |
84
+ | `receipt_schema` | Local brewdoc.receipt/1 or URL brewdoc.receipt/2 |
85
+ | `route`, `source`, `unit_kind`, `units` | Reader, local filename/redacted URL, content kind/count |
86
+ | `tables`, `text_regions`, `columns_split` | Conversion tallies |
87
+ | `dropped`, `broken_ligature_words` | Counted normalization; malformed font words are folded, not guessed |
88
+ | `not_carried` | Structural omissions; read before concluding a fact is absent |
89
+ | `out` | Markdown path, or null for stdout |
90
+ | `markdown_schema`, `unit_keys`, `artifacts` | Success-only schema, ordered source keys and available/requested artifacts |
91
+ | `selected_sheets` | Caller-ordered names, only when selected |
92
+ | `acquisition` | URL provenance, frozen snapshot and capture status |
93
+
94
+ Exit 0 means conversion, 1 refusal and 2 invalid usage. Success does not prove content fidelity or complete JavaScript.
95
+ PDF/DOCX/PPTX/workbooks emit ASCII; HTML/EPUB emit UTF-8 without BOM, with LF newlines. JSON keeps ASCII escaping.
96
+ The same local file or frozen snapshot produces identical bytes; live pages can change.
97
+
98
+ ## Python API
295
99
 
296
100
  ```python
297
101
  import brewdoc
298
102
 
299
- markdown, tally = brewdoc.render_epub("book.epub")
300
103
  code, receipt, markdown = brewdoc.run("book.epub", out="book.md")
301
104
  markdown, tally = brewdoc.render_html("page.html")
302
- code, receipt, markdown = brewdoc.run("page.html", out="page.md")
303
- markdown, tally = brewdoc.render_presentation("slides.pptx")
304
105
  refs = brewdoc.list_book_artifacts("book.xlsm", sheets=("Calc",))
305
106
  payload = brewdoc.read_book_artifact("book.xlsm", refs[0].key, sheets=("Calc",))
306
- code, receipt, markdown = brewdoc.run(
307
- "book.xlsm", out="book.md", sheets=("Calc",),
308
- artifact_outputs={refs[0].key: "formulas.json"},
309
- )
310
107
  ```
311
108
 
312
- `artifact_outputs` maps artifact keys to paths. The CLI builds it from repeated `--artifact KEY=PATH`.
313
-
314
- CSV and TSV are intentionally unsupported and are not planned. LLMs can read their text tables
315
- directly, so brewdoc does not convert them to Markdown.
316
-
317
- Planned formats, excluded ones, deferred ones and the never-list: `FORMATS.md`.
318
- A planned format is refused by name today. The adapter contract and the ordered checklist for
319
- adding one are in [`docs/architecture.md`](docs/architecture.md).
109
+ `run` accepts `sheets` and an `artifact_outputs` key-to-path mapping. Renderers include
110
+ `render_pdf`, `render_doc`, `render_presentation`, `render_epub`, `render_html` and `render_book`.
111
+ `read_formulas` provides typed formulas; `self_check` verifies installed routes. Local APIs never acquire URLs.
320
112
 
321
- PDF regions, in the order tried:
113
+ ## Explicit URL acquisition
322
114
 
323
- | region looks like | rendered as |
324
- |---|---|
325
- | ruled on all sides | Markdown table from the drawn ruling |
326
- | ruling unfinished (cells never closed) | source baselines recovered as logical rows on the inferred structural grid |
327
- | ruled across only (head and foot rules) | column grid from the rule segment ends |
328
- | unruled, tabular band | layout-preserved text |
329
- | unruled, captioned `Table N` | the band is bounded first (caption to next blank band), then read as a table |
330
- | two-column prose | split at the gutter (relative density on the character x-histogram), left then right |
331
- | plain prose | lines |
332
-
333
- ## What it does not do
334
-
335
- | gap | behaviour |
336
- |---|---|
337
- | OCR | a PDF with no text layer is refused by name, never rendered empty |
338
- | PDF and DOCX images, figures, text drawn inside them | not carried; listed in `not_carried` |
339
- | PPTX pictures | represented by deterministic name, size, alt text, caption, source and byte-count placeholders; pixels are never emitted |
340
- | EPUB layout, scripts, media and graphics | CSS, pagination, font rendering, scripts, active media, image pixels and unsupported SVG/MathML semantics are omitted |
341
- | PPTX charts, SmartArt, audio, video and embedded objects | not carried; listed in `not_carried` |
342
- | a table spanning a page break | columns recovered, wrapped rows stay separate rows |
343
- | text rotated out of horizontal reading order | not carried |
344
- | sub/superscripts | folded back into their line (`NH4H2PO4`, not `NHHPO` over `4 2 4`) |
345
- | broken font CMaps (ligatures mapped to wrong code points) | counted (`broken_ligature_words`), folded to ASCII, never guessed back |
346
- | formula calculation | cached values in Markdown; passive source formulas only for `.xlsx` and `.xlsm` |
347
- | readable VBA source | unavailable; `.xlsm` and `.xlsb` preserve a related project only as opaque bytes |
348
-
349
- ## Determinism
350
-
351
- No timestamps or unordered iteration. Two renders of one file have the same sha256;
352
- `--self-check` pins it. PDF, DOCX, PPTX and workbook output remains ASCII. HTML and EPUB Markdown use
353
- UTF-8 without BOM and LF newlines, with the same bytes in the API, file output and CLI stdout.
354
- Receipt JSON keeps ASCII escaping.
355
-
356
- ## Size and speed
357
-
358
- These measurements cover the existing PDF/workbook baseline before the HTML parser addition.
359
- They do not measure HTML or EPUB conversion or the new installed footprint.
360
-
361
- | measure | value |
362
- |---|---|
363
- | installed footprint | ~45 MB (pdfplumber, pypdfium2, Pillow, cryptography, python-calamine) |
364
- | import | 0.08 s |
365
- | 130-page PDF | ~5.5 s |
366
- | 14-sheet xlsx | ~0.9 s |
115
+ `--url` deliberately acquires a public HTTP(S) page before local conversion.
367
116
 
368
- ## Benchmarks
369
-
370
- Browse the [corpus catalog](benchmarks/CATALOG.md), follow the
371
- [measurement method](benchmarks/METHODOLOGY.md), and inspect the
372
- [full-run results](benchmarks/results/README.md). Completed runs include actual
373
- outputs and known failures; capture completion does not mean content quality passed.
117
+ ```sh
118
+ brewdoc --url https://example.com/article --out article.md
119
+ brewdoc --url https://example.com/article --render-js --timeout 30 --out article.md
120
+ ```
374
121
 
375
- ## Releasing
122
+ `--timeout` is one positive finite waiting budget, default 30 seconds; cleanup/conversion can add time.
123
+ Public destinations, DNS, redirects, TLS, requests and bytes are validated. Ordinary requests use GET;
124
+ JS admits only the narrow credential-free HN Algolia XHR POST exception. Local HTML never fetches or runs scripts.
125
+ Optional JS needs installed/bundled prerequisites, refuses unsupported runtimes before HTTP and downloads no engine.
126
+ Timing-only expiry can preserve valid partial content; hard failures refuse output. [Full URL/JS limits](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/FORMATS.md#url-acquisition).
376
127
 
377
- Tag-triggered, see `RELEASING.md`.
378
- Coding agents can start with the compact [llms.txt](llms.txt) guide. It does not imply
379
- automatic discovery by any client.
128
+ [Format contracts](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/FORMATS.md) | [Corpus](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/benchmarks/CATALOG.md) | [Measurements](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/benchmarks/METHODOLOGY.md) | [Results](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/benchmarks/results/README.md)
129
+ [Releasing](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/RELEASING.md) | [Agent entry point](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/llms.txt) | [MIT license](https://github.com/kochetkov-ma/brewdoc/blob/v0.3.3/LICENSE)
380
130
 
381
- ## License
131
+ ## Related projects
382
132
 
383
- MIT, see `LICENSE`.
133
+ - [BrewPage](https://brewpage.app): free hosting for HTML, Markdown, JSON and files; each upload returns a shareable HTTPS link.
134
+ - [BrewPage MCP server](https://github.com/kochetkov-ma/brewpage-openapi/tree/main/mcp-server): npm package `brewpage-mcp` for publishing to BrewPage from MCP clients.
135
+ - [claude-brewcode](https://github.com/kochetkov-ma/claude-brewcode): plugin suite for Claude Code, with [documentation](https://doc-claude.brewcode.app). Its brewdoc plugin is a different tool from this brewdoc CLI.
136
+ - [brewcode.app](https://brewcode.app): home site of the Brew projects.
Binary file