diff --git a/AGENTS.md b/AGENTS.md index 00879f4..d8b4e7e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,7 +14,7 @@ When a `.md` file is requested, `src/md2html.php` loads the Markdown, converts i ## Environment Assumptions - NGINX supplies the original request URI and the site document root via FastCGI. -- The project can live outside the document root. NGINX exposes exact asset URLs under `/_md2html/`. +- The project can live outside the document root. PHP embeds local CSS/JS into HTML; no static asset URLs are required. - An external symlink requires an explicitly configured URL prefix and target directory. See README.md. ## Change Priorities @@ -35,8 +35,8 @@ When a `.md` file is requested, `src/md2html.php` loads the Markdown, converts i ## PHP Rules (`src/md2html.php`) - Keep dependency loading via the project root's `vendor/autoload.php`, resolved relative to the entrypoint directory. -- Keep response minimal: ``, UTF-8 and viewport meta, stylesheet link, deferred script, navigation controls, and wrapped content. -- Keep CSS and JS URLs versioned using `md5_file()` on paths relative to `__DIR__`. +- Keep response minimal: ``, UTF-8 and viewport meta, inline style, navigation controls, wrapped content, and inline script after the content. +- Load CSS and JS from paths relative to `__DIR__`; safely escape closing script tags when embedding JavaScript. - Do not assign anonymous functions or closures to PHP variables; use named functions or class methods. - Output helpers should return rendered content for callers to consume. - Validate the decoded URL path, including the `.md` extension, before filesystem lookup. Query parameters must never select a file. @@ -60,7 +60,7 @@ When a `.md` file is requested, `src/md2html.php` loads the Markdown, converts i - `./tests/run.ps1` when the local suite is available - `git diff --check` - Tests require PHP with DOM, Composer dependencies, and Node.js supporting `node:test` and `--test-isolation=none`. -- Keep regression coverage for heading levels, formatting, code fences, duplicate and existing anchors, Unicode, empty and long contents, URL-specific state, blocked storage, mobile dismissal, asset hashes, and the `.md` guard. +- Keep regression coverage for heading levels, formatting, code fences, duplicate and existing anchors, Unicode, empty and long contents, URL-specific state, blocked storage, mobile dismissal, inline assets, script escaping, and the `.md` guard. - DOM doubles do not verify actual layout or scrolling. Igor manually checks desktop/mobile layout, long-panel scrolling, anchor navigation, and readability of Markdown elements. ## Non-Goals diff --git a/README.md b/README.md index c606778..2793df5 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,34 @@ # MD2HTML -Konverzia Markdown do HTML, pouzitelne aj pre priame zobrazovanie Markdown suborov pomocou webservera. +Malý nástroj na zobrazovanie Markdown súborov cez NGINX. PHP načíta dokument podľa URL, prevedie ho pomocou Parsedown a vráti samostatné HTML s responzívnym vzhľadom a interaktívnym obsahom z nadpisov H1 až H3. -Zdrojove subory su v adresari `src/`: +## Požiadavky a inštalácia -- `src/md2html.php`: vstupny bod konverzie Markdown do HTML. -- `src/markdown.css`: styly vystupneho HTML. -- `src/toc.js`: interaktivny obsah dokumentu bez externych JS zavislosti. +- PHP 8.0 alebo novšie s rozšírením `mbstring`, pre NGINX aj PHP-FPM alebo FastCGI. +- Composer na inštaláciu serverovej knižnice Parsedown. +- NGINX a účet PHP s právom čítať projekt aj publikované dokumenty. -Závislosti nainštaluj príkazom `composer install` v koreni projektu. -Použi PHP 8 alebo novšie s rozšírením mbstring. Projekt môže byť mimo webového koreňa. +V koreňovom adresári projektu spusti: + +```sh +composer install +``` + +Projekt môže byť mimo webového koreňa. Nasadzuj `src/` aj `vendor/`; autoload sa načítava relatívne k PHP vstupnému bodu. + +- `src/md2html.php`: výber dokumentu, konverzia a generovanie HTML. +- `src/markdown.css`: štýly, ktoré PHP vloží priamo do `'; +echo ''; echo ''; echo ''; echo '