# Property Ontology explorer

Small Express app that hosts the two generated documents and lets a human browse every file in this repository with helpful rendering.

| Route | What it serves |
|---|---|
| `/` | Landing page: links to the documents, top-level folders, file-type stats and the ontology README |
| `/report` | `property-ontology/documentation/ontology-board-report.html` with the site nav bar injected (hides on scroll down, returns on scroll up); `?raw` serves the untouched file |
| `/atlas` | `property-ontology/documentation/semantic-atlas.html`, same treatment |
| `/files/<path>` | Directory listing (with README rendered below) or a rendered file view |
| `/files/<path>?source` | Source view for files that are rendered by default (Markdown, JSONL, SVG, HTML) |
| `/raw/<path>` | Raw file with the correct content type; add `?download` for an attachment |
| `/api/tree` | Flat JSON list of every browsable file (used by the `/` file finder) |
| `/healthz` | Health check |

## Rendering

- Markdown: GFM via `marked`, heading anchors, table of contents, `mermaid` fences rendered lazily in the browser, relative links rewritten to explorer routes (broken links are flagged), images served from `/raw`.
- Code: `highlight.js` with line numbers and shareable line anchors (`#L12`, shift-click for `#L12-L20`). Custom grammars are registered for Turtle (`.ttl`) and SPARQL (`.rq`).
- JSON Lines: one collapsible pretty-printed card per record.
- HTML: sandboxed preview with a link to the full page; SVG shown as an image; binaries (`.docx`, `.zip`) offered as downloads.

## Running locally

```bash
cd explorer
npm install
npm start           # http://localhost:3000, browses the parent directory
```

Environment variables: `PORT` (default 3000), `REPO_ROOT` (default: parent of `explorer/`), `REPORT_PATH`, `ATLAS_PATH`, `README_PATH`.

## Deployment

The repository root `Dockerfile` builds this app and copies the whole repo to `/repo` inside the image, so the deployed explorer always shows exactly what was deployed. `.git`, `.env*`, `node_modules` and `__pycache__` are excluded (`.dockerignore`) and are also hidden by the app's own ignore list.
