Add Markdown parser and web documentation viewer#118
Conversation
Agent-Logs-Url: https://github.com/marpisco/ClassLink/sessions/53f21190-7213-48ca-816d-319073cefcf7 Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
|
@copilot For example
Do you understand? |
…ssing Agent-Logs-Url: https://github.com/marpisco/ClassLink/sessions/92efbb78-5afc-485a-9968-5fb0a9629cfa Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
... Done in commit The | Column 1 | Column 2 | Column 3 |
| -------- | -------- | -------- |
| United with Column 2 || Column 3 |
| Single Line |||Produces:
Inline Markdown within cells ( Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Replaces the static PDF manual with a Markdown-based documentation system rendered in-browser using the app's native styling, with support for GFM tables and merged/colspan cells via the
||column-span syntax.Changes
Dependency
league/commonmark^2.8 — CommonMark + GFM extension (pipe tables, strikethrough, task lists, autolinks)func/markdown.phpparse_markdown(string $markdown): string— parses Markdown and post-processes HTML to inject Bootstrap classes (table-bordered table-striped,table-dark thead,img-fluid, etc.) so rendered output matches native app stylingapply_cell_merging(string $html): string— post-processes the rendered HTML via DOMDocument to implement the||column-span syntax: GFM renders each||as an empty<td></td>; this function removes those empty cells and appliescolspanto the preceding cellhtml_inputis set to'strip'— raw HTML in Markdown files is stripped for security; merged tables must use the||syntaxdocs/— documentation viewerdocs/index.php— authenticated viewer; dynamically lists all.mdfiles fromdocs/; file selection usesbasename()+in_array()whitelist to block directory traversaldocs/manual_utilizador.md— user manual ported to Markdown (replaces the PDF)assets/docs.csstheme.cssCSS variables — light/dark mode works automaticallyNavigation updates
index.php— "Manual de Utilizador (PDF)" button replaced with "Documentação" →/docs/; nav link addedadmin/index.php— "Documentação" link added to admin navbarMerged/colspan table support
Merged cells are supported using the
||column-span syntax directly in Markdown tables. Each||absorbs one additional column into the preceding cell'scolspan:<td colspan="2">, "Column 3" is in column 3<td colspan="3">Inline Markdown within cells (
**bold**,*italic*,`code`) is fully preserved since merging happens after CommonMark renders the cell content.Adding new documentation requires only dropping a
.mdfile intodocs/— it appears in the sidebar automatically.