$npx -y skills add QuZhan51496/paper2anything --skill paper2htmlConvert an academic paper PDF into a publish-ready, self-contained single-page project homepage (a self-contained index.html) — the kind of paper landing page researchers host on GitHub Pages. Triggers when the user says "turn a paper into a project page/webpage", "paper2html
| 1 | # paper2html — Paper to single-page project homepage (you-led, coordinated) |
| 2 | |
| 3 | Turn a paper PDF into a **self-contained, publish-ready single-page project website** — the kind of paper |
| 4 | homepage researchers commonly build on GitHub Pages. |
| 5 | **You are the lead author**: this file is the recipe, not a fully automated script — there is no `main.py`, |
| 6 | no renderer. The mechanical steps (parse / extract / QA) call the small tools under `scripts/`; **understanding |
| 7 | the paper, designing the page, and writing `index.html` are done by you** (read the material and figures with |
| 8 | Read, write `index.html` with Write), confirming with the user at key points via `AskUserQuestion`. |
| 9 | |
| 10 | ```text |
| 11 | |
| 12 | → parse + extract (parse_pdf.py: MinerU → clean.md + manifest.json + images/, gate 1) |
| 13 | → you understand it + set the design (read manifest + clean.md + look at figures) → pick a design language [confirm design direction] |
| 14 | → you hand-author the page (per the references/ design-language and authoring rules) → index.html [optional confirm] |
| 15 | → QA validation (validate.py: missing figures/broken links/content fidelity, gate 2) → fix per report, loop |
| 16 | → single-page project homepage index.html (+ images/, deployable as-is) |
| 17 | ``` |
| 18 | |
| 19 | ## How you run this skill |
| 20 | |
| 21 | 1. **Step by step**: run scripts for the mechanical steps via `Bash` (absolute paths, no cd needed); do the design and authoring yourself with `Read`/`Write`. |
| 22 | 2. **Compute `WORKDIR` inline at the top of each Bash block** (each Bash call is a separate shell and does not share variables): |
| 23 | ```bash |
| 24 | WORKDIR="$(dirname "$pdf_path")/.paper2anything/html/$(basename "${pdf_path%.*}")" |
| 25 | ``` |
| 26 | `$pdf_path` is the paper PDF the user gave (reset it in each block). The scripts live in `${SKILL_DIR}/scripts` — `SKILL_DIR` |
| 27 | is **this skill's directory** (see "Base directory for this skill: …" injected at the top of this skill); each Bash block is a |
| 28 | separate shell, so in the blocks that use it `export SKILL_DIR=<that directory>` once at the top (set it inline each time, like `WORKDIR`). |
| 29 | 3. **Pause at decision points with `AskUserQuestion`**: after understanding the paper, confirm the **design direction** (design language / primary color / emphasis); after the draft is done, you may confirm again. |
| 30 | 4. **Faithful to the manifest, you fill the gaps**: use only the real material in `manifest.json`, don't fabricate numbers/authors/links; fields the manifest left empty |
| 31 | (authors/abstract/links etc.) you complete from the full text of `clean.md` — you are the lead author, deterministic extraction is only scaffolding. |
| 32 | |
| 33 | --- |
| 34 | |
| 35 | ## Step 0: Environment and credentials |
| 36 | |
| 37 | > **Unified environment**: all `python` commands run in paper2anything's unified conda environment (top-level `environment.yml`), |
| 38 | > prefixed with `conda run -n paper2anything --no-capture-output`. |
| 39 | |
| 40 | Credentials are centralized in the package-root `.env` (copied from `.env.example`, already gitignored); export it once per new shell: |
| 41 | |
| 42 | ```bash |
| 43 | set -a; source <paper2anything package root>/.env; set +a |
| 44 | ``` |
| 45 | |
| 46 | This skill **only needs `MINERU_API_TOKEN`** (to parse the PDF). **Page design and authoring are done by you, calling no LLM API**, |
| 47 | so no OPENAI/LLM key is needed. |
| 48 | |
| 49 | Dependency self-check: |
| 50 | |
| 51 | ```bash |
| 52 | conda run -n paper2anything --no-capture-output python -c "import requests, rich, dotenv, playwright, PIL" 2>&1 |
| 53 | # render_check.py (Step 4 render self-check) needs the chromium engine; install it once before the first run: |
| 54 | # conda run -n paper2anything --no-capture-output python -m playwright install chromium |
| 55 | ``` |
| 56 | |
| 57 | --- |
| 58 | |
| 59 | ## Step 1: Parse + deterministic extraction (script, gate 1) |
| 60 | |
| 61 | ```bash |
| 62 | pdf_path="/path/to/paper.pdf" # ← the user's paper PDF |
| 63 | WORKDIR="$(dirname "$pdf_path")/.paper2anything/html/$(basename "${pdf_path%.*}")" |
| 64 | conda run -n paper2anything --no-capture-output \ |
| 65 | python "${SKILL_DIR}/scripts/parse_pdf.py" "$pdf_path" --workdir "$WORKDIR" |
| 66 | ``` |
| 67 | |
| 68 | Outputs (under `$WORKDIR`): |
| 69 | - `clean.md` — normalized full-text markdown (for you to read through) |
| 70 | - `manifest.json` — deterministically extracted facts: title/authors/affiliations/abstract/links/claim |