add files

This commit is contained in:
김경종
2026-04-30 17:05:19 +09:00
parent f3e01b5a8c
commit 7e985ae94a
135 changed files with 41205 additions and 0 deletions
@@ -0,0 +1,26 @@
{
"project": "PDFtoMD",
"phase": "5-markdown-rendering-assets",
"steps": [
{
"step": 0,
"name": "markdown-block-renderer",
"status": "pending"
},
{
"step": 1,
"name": "table-renderer-fallbacks",
"status": "pending"
},
{
"step": 2,
"name": "figure-asset-writer",
"status": "pending"
},
{
"step": 3,
"name": "chunk-renderer",
"status": "pending"
}
]
}
@@ -0,0 +1,38 @@
# Step 0: markdown-block-renderer
## Read First
- /AGENTS.md
- /PLAN.md
- /PROGRESS.md
- /docs/HARNESS.md
- /docs/IMPLEMENTATION_PLAN.md
- /docs/ARCHITECTURE.md
- /docs/CONVERSION_POLICY.md
- /phases/4-semantic-enrichment/index.json
## Task
Implement block-level Markdown rendering for headings, paragraphs, lists, blockquotes, formulas, captions, and simple references.
Renderer tests should use internal block fixtures, not live PDF parsing.
## Sprint Contract
- Done means: core block types render to deterministic Markdown strings with focused tests.
- Hard thresholds: math delimiter validation is applied; renderer does not inject warnings/errors into Markdown; output is stable across runs.
- Files owned: `src/pdftomd/renderer.py`, tests, `PROGRESS.md`, `phases/5-markdown-rendering-assets/index.json`.
- Dependencies: Phase 4 enriched blocks and Phase 3 formula outputs.
## Acceptance Criteria
```powershell
python scripts\validate_workspace.py
.\venv\python.exe -m pytest tests
```
## Verification
1. Run the acceptance commands.
2. Confirm renderer tests are focused, not full snapshots.
3. Update `PROGRESS.md` and this phase index.
## Do Not
- Do not invoke Marker or Nougat.
- Do not implement table/asset file writing in this step.
- Do not add sidecar document outputs.
@@ -0,0 +1,37 @@
# Step 1: table-renderer-fallbacks
## Read First
- /AGENTS.md
- /PLAN.md
- /PROGRESS.md
- /docs/HARNESS.md
- /docs/IMPLEMENTATION_PLAN.md
- /docs/CONVERSION_POLICY.md
- /phases/5-markdown-rendering-assets/step0.md
## Task
Implement table rendering policy for Markdown tables, limited HTML tables, and image fallback links.
Use structured table objects and avoid ad hoc string parsing for complex cases where possible.
## Sprint Contract
- Done means: simple tables render as Markdown, complex tables can render as limited HTML or fallback references, and table captions/footnotes are preserved.
- Hard thresholds: tests cover merged-cell-like structures, footnotes, captions, and table fallback decisions; invalid table output is detected by quality gates.
- Files owned: `src/pdftomd/renderer.py`, table models/tests, `PROGRESS.md`, phase index.
- Dependencies: Step 0 renderer and Phase 0 quality gates.
## Acceptance Criteria
```powershell
python scripts\validate_workspace.py
.\venv\python.exe -m pytest tests
```
## Verification
1. Run the acceptance commands.
2. Confirm fallback images are linked but not generated unless a table asset exists.
3. Update `PROGRESS.md` and this phase index.
## Do Not
- Do not fake table content that was not extracted.
- Do not discard captions or footnotes.
- Do not implement full HTML sanitizer scope beyond limited table output.
@@ -0,0 +1,39 @@
# Step 2: figure-asset-writer
## Read First
- /AGENTS.md
- /PLAN.md
- /PROGRESS.md
- /docs/HARNESS.md
- /docs/IMPLEMENTATION_PLAN.md
- /docs/ARCHITECTURE.md
- /docs/CONVERSION_POLICY.md
- /phases/1-core-runtime-contracts/step2.md
- /phases/5-markdown-rendering-assets/step0.md
## Task
Implement deterministic image/figure asset writing and Markdown image reference generation.
Use hash-based deduplication when asset bytes are available and preserve figure captions and reference anchors.
## Sprint Contract
- Done means: figure assets can be written to temp output bundles with deterministic names and Markdown references.
- Hard thresholds: duplicate images share stored assets where configured; Korean path output is tested; missing assets produce validation failures, not broken silent links.
- Files owned: `src/pdftomd/assets.py`, renderer integration/tests, `PROGRESS.md`, phase index.
- Dependencies: Output bundle contract and renderer.
## Acceptance Criteria
```powershell
python scripts\validate_workspace.py
.\venv\python.exe -m pytest tests
```
## Verification
1. Run the acceptance commands.
2. Confirm tests write only to temporary directories.
3. Update `PROGRESS.md` and this phase index.
## Do Not
- Do not write into real `output/` during tests.
- Do not rename source PDFs.
- Do not drop figure captions.
@@ -0,0 +1,39 @@
# Step 3: chunk-renderer
## Read First
- /AGENTS.md
- /PLAN.md
- /PROGRESS.md
- /docs/HARNESS.md
- /docs/IMPLEMENTATION_PLAN.md
- /docs/ARCHITECTURE.md
- /docs/CONVERSION_POLICY.md
- /phases/1-core-runtime-contracts/step2.md
- /phases/5-markdown-rendering-assets/step2.md
## Task
Implement chunk planning and chunk Markdown bundle writing over enriched blocks.
Chunk boundaries should target 20 pages but preserve logical block integrity for paragraphs, tables, figures, and formulas.
## Sprint Contract
- Done means: chunk files with frontmatter can be written deterministically from internal document fixtures.
- Hard thresholds: block integrity is preserved at chunk boundaries; chunk frontmatter includes minimum context; quality gates run on rendered chunks.
- Files owned: `src/pdftomd/chunking.py`, `src/pdftomd/renderer.py`, tests, `PROGRESS.md`, phase index.
- Dependencies: Renderer, assets, and output bundle contracts.
## Acceptance Criteria
```powershell
python scripts\validate_workspace.py
.\venv\python.exe -m pytest tests
```
## Verification
1. Run the acceptance commands.
2. Confirm long-document chunk fixtures cover boundary behavior.
3. Update `PROGRESS.md` and this phase index.
## Do Not
- Do not split blocks in the middle to satisfy exact 20-page counts.
- Do not create document sidecar metadata files.
- Do not implement CLI orchestration here.