presunute zdrojove kody do ./src/

This commit is contained in:
2026-10-26 18:44:34 +01:00
parent 6c6a6c7dfe
commit 58e3a7503c
5 changed files with 20 additions and 10 deletions
+1
View File
@@ -1 +1,2 @@
"/vendor/" "/vendor/"
/vendor
+7 -7
View File
@@ -2,17 +2,17 @@
## Purpose ## Purpose
This project is a small Markdown-to-HTML utility used behind NGINX. This project is a small Markdown-to-HTML utility used behind NGINX.
When a `.md` file is requested, `md2html.php` loads the Markdown, converts it with Parsedown, and renders HTML styled by `markdown.css`. When a `.md` file is requested, `src/md2html.php` loads the Markdown, converts it with Parsedown, and renders HTML styled by `src/markdown.css`.
## Key Files ## Key Files
- `md2html.php`: entrypoint for conversion and HTML output. - `src/md2html.php`: entrypoint for conversion and HTML output.
- `markdown.css`: visual styling for rendered Markdown (`.markdown-body`). - `src/markdown.css`: visual styling for rendered Markdown (`.markdown-body`).
- `composer.json`: PHP dependency config (`erusev/parsedown`). - `composer.json`: PHP dependency config (`erusev/parsedown`).
## Environment Assumptions ## Environment Assumptions
- Project root: `D:\www\md2html` - Project root: `D:\www\md2html`
- Markdown files are resolved from `D:\www\...` - Markdown files are resolved from `D:\www\...`
- CSS is currently linked as `//localhost/md2html/markdown.css` - CSS is currently linked as `//localhost/md2html/src/markdown.css`
## Change Priorities ## Change Priorities
1. Keep output readable on desktop and mobile. 1. Keep output readable on desktop and mobile.
@@ -20,15 +20,15 @@ When a `.md` file is requested, `md2html.php` loads the Markdown, converts it wi
3. Avoid introducing JS unless explicitly required. 3. Avoid introducing JS unless explicitly required.
4. Keep the utility simple and fast. 4. Keep the utility simple and fast.
## Styling Rules (`markdown.css`) ## Styling Rules (`src/markdown.css`)
- Style only inside `.markdown-body` unless there is a strong reason to change global page behavior. - Style only inside `.markdown-body` unless there is a strong reason to change global page behavior.
- Must cover: headings, links, lists, blockquotes, inline code, code blocks, tables, images, hr. - Must cover: headings, links, lists, blockquotes, inline code, code blocks, tables, images, hr.
- Keep strong contrast and accessible font sizes. - Keep strong contrast and accessible font sizes.
- Ensure long code lines and wide tables remain usable on small screens (`overflow-x`). - Ensure long code lines and wide tables remain usable on small screens (`overflow-x`).
- Prefer CSS variables for colors and spacing to simplify future theme changes. - Prefer CSS variables for colors and spacing to simplify future theme changes.
## PHP Rules (`md2html.php`) ## PHP Rules (`src/md2html.php`)
- Keep dependency loading via `vendor/autoload.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 meta, stylesheet link, wrapped content. - Keep response minimal: `<!doctype html>`, UTF-8 meta, stylesheet link, wrapped content.
- Do not remove `.md` extension guard. - Do not remove `.md` extension guard.
- Any path-handling changes must remain compatible with Windows paths. - Any path-handling changes must remain compatible with Windows paths.
+10 -1
View File
@@ -1,3 +1,12 @@
# MD2HTML # MD2HTML
Koverzia Markdown do HTML, pouzitelne aj pre priame zobrazovanie Markdown suborov pomocou webservera. Koverzia Markdown do HTML, pouzitelne aj pre priame zobrazovanie Markdown suborov pomocou webservera.
Zdrojove subory su v adresari `src/`:
- `src/md2html.php`: vstupny bod konverzie Markdown do HTML.
- `src/markdown.css`: styly vystupneho HTML.
Zavislosti sa instaluju cez `composer install` v koreni projektu do `vendor/`.
Konfiguracia NGINX musi smerovat Markdown poziadavky na `src/md2html.php`.
CSS sa nacitava z `//localhost/md2html/src/markdown.css`.
View File
+2 -2
View File
@@ -1,5 +1,5 @@
<?php <?php
require 'vendor/autoload.php'; require dirname(__DIR__) . '/vendor/autoload.php';
$path = $_GET['file'] ?? $_SERVER['REQUEST_URI']; $path = $_GET['file'] ?? $_SERVER['REQUEST_URI'];
$file = realpath('d:/www/' . $path); $file = realpath('d:/www/' . $path);
@@ -14,7 +14,7 @@ $parser = new Parsedown();
echo '<!doctype html>'; echo '<!doctype html>';
echo '<meta charset="utf-8">'; echo '<meta charset="utf-8">';
echo '<link rel="stylesheet" href="//localhost/md2html/markdown.css">'; echo '<link rel="stylesheet" href="//localhost/md2html/src/markdown.css">';
echo '<div class="markdown-body">'; echo '<div class="markdown-body">';
echo $parser->text($md); echo $parser->text($md);
echo '</div>'; echo '</div>';