File size: 1,594 Bytes
ef987bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Offline Markdown-to-PDF batch converter

Complete the supplied Node.js converter in `convert.js`. Keep the bundled `samples/` directory. Convert local Markdown to readable PDFs without network access.

## Interface and output

Run `node convert.js <input-directory> <output-directory>` or import the exported `convertBatch(inputDir, outputDir)`. The export may finish synchronously or return a Promise that resolves once conversion is complete.

Convert every top-level `.md` input to a separate `.pdf` with the same base name, including names containing Chinese characters. Generate genuine PDFs with extractable text; any valid internal PDF representation is acceptable. Render level-one headings, bold and inline code without the raw Markdown delimiters. Render inline `\(\sqrt{2}\)` as a readable square-root expression such as √2 or `sqrt(2)`, retaining the surrounding text without raw LaTeX markers.

Preserve both Chinese and English glyphs and text. Wrap long lines, paginate long documents and keep text within the page. The environment includes Playwright/Chromium, Poppler and Noto CJK fonts; other offline implementations are allowed.

## Acceptance Checklist

- The CLI and exported function produce parseable PDFs. Each input has a correctly named output with its own content and no text belonging to another input.
- Text extraction preserves Chinese and English content, heading/bold/code text and the rendered inline square root without raw syntax.
- Long documents retain their content through the end; wrapped and paginated text lies inside the visible page boundaries.