includovanie CSS a JS do vystupneho HTML aby nebolo potrebne linkovat subory

This commit is contained in:
2026-11-06 10:07:37 +01:00
parent 81e31a5468
commit a9022e1fb2
3 changed files with 57 additions and 56 deletions
+4 -4
View File
@@ -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: `<!doctype html>`, 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: `<!doctype html>`, 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