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
+7 -7
View File
@@ -2,17 +2,17 @@
## Purpose
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
- `md2html.php`: entrypoint for conversion and HTML output.
- `markdown.css`: visual styling for rendered Markdown (`.markdown-body`).
- `src/md2html.php`: entrypoint for conversion and HTML output.
- `src/markdown.css`: visual styling for rendered Markdown (`.markdown-body`).
- `composer.json`: PHP dependency config (`erusev/parsedown`).
## Environment Assumptions
- Project root: `D:\www\md2html`
- 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
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.
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.
- Must cover: headings, links, lists, blockquotes, inline code, code blocks, tables, images, hr.
- Keep strong contrast and accessible font sizes.
- 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.
## PHP Rules (`md2html.php`)
- Keep dependency loading via `vendor/autoload.php`.
## 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 meta, stylesheet link, wrapped content.
- Do not remove `.md` extension guard.
- Any path-handling changes must remain compatible with Windows paths.
+9
View File
@@ -1,3 +1,12 @@
# MD2HTML
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
require 'vendor/autoload.php';
require dirname(__DIR__) . '/vendor/autoload.php';
$path = $_GET['file'] ?? $_SERVER['REQUEST_URI'];
$file = realpath('d:/www/' . $path);
@@ -14,7 +14,7 @@ $parser = new Parsedown();
echo '<!doctype html>';
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 $parser->text($md);
echo '</div>';