This tool extracts the main content of Unity's offline HTML documentation (Manual and ScriptReference) and converts it into clean, Markdown-like text files suitable for RAG (Retrieval-Augmented Generation) pipelines.
- Extracts only the
div.sectioncontent (the main body of each page). - Removes unnecessary UI elements: navigation, feedback widgets, footers, etc.
- Preserves all textual information, including:
- Headings →
#Markdown headings - Inline code →
`code` - Multi-line code blocks →
```langfenced blocks - Tables → pipe tables
- Links → resolved to local doc IDs or external URLs.
- Glossary tooltips → rendered as parenthetical definitions.
- Headings →
- Outputs each page as a
.txtfile with:- First line: the doc path
- Second line:
breadcrumb:if present - The rest: the formatted content.
- Node.js (v12 or later)
- npm package
cheerio
- Place
convert.js,worker.js, andrun.jsin a folder. - In that folder, symlink (or copy) the
Manual/andScriptReference/directories from your downloaded Unity documentation:
New-Item -ItemType SymbolicLink -Path "Manual" -Target "D:\Path\To\Your\UnityDocs\Manual"
New-Item -ItemType SymbolicLink -Path "ScriptReference" -Target "D:\Path\To\Your\UnityDocs\ScriptReference"- Install cheerio:
npm install cheerio - Run
node run.js - The output will appear under
output/. The conversion will keep the exact folder hierarchy of Unity docs.
- A report (
conversion-report.json) with details of any failed pages will be generated. - The conversion is designed to be lossless for textual content; images are represented as
placeholders. - External links are kept as-is; internal links are converted to local doc IDs without the
.htmlextension. - If you notice any leftover UI elements appearing in the output, you can add their CSS selector to the
CRUFT_SELECTORSarray inconvert.js. - The script processes all
.htmland.htmfiles recursively inManual/andScriptReference/.
This project is not affiliated with, endorsed by, or sponsored by Unity Technologies. Unity, the Unity logo, and all related trademarks are the property of Unity Technologies or their respective owners. The documentation included in this repository's release file is the intellectual property of Unity Technologies and is provided here for reference and convenience only. All rights remain with Unity Technologies.