Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unity Documentation Converter

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.

Features

  • Extracts only the div.section content (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 → ```lang fenced blocks
    • Tables → pipe tables
    • Links → resolved to local doc IDs or external URLs.
    • Glossary tooltips → rendered as parenthetical definitions.
  • Outputs each page as a .txt file with:
    • First line: the doc path
    • Second line: breadcrumb: if present
    • The rest: the formatted content.

Requirements

  • Node.js (v12 or later)
  • npm package cheerio

Usage

  1. Place convert.js, worker.js, and run.js in a folder.
  2. In that folder, symlink (or copy) the Manual/ and ScriptReference/ 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"
  1. Install cheerio: npm install cheerio
  2. Run node run.js
  3. The output will appear under output/. The conversion will keep the exact folder hierarchy of Unity docs.

Notes

  • 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 ![alt](src) placeholders.
  • External links are kept as-is; internal links are converted to local doc IDs without the .html extension.
  • If you notice any leftover UI elements appearing in the output, you can add their CSS selector to the CRUFT_SELECTORS array in convert.js.
  • The script processes all .html and .htm files recursively in Manual/ and ScriptReference/.

Legal

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.

About

Extracts the content of Unity's Manual and ScriptReference as Markdown for RAG workflows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages