mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 08:09:18 +02:00
Replace every <img src="/assets/icons/..."> with <?= icon('name') ?>
across 26 template files. The PHP helper inlines the SVG markup into the
DOM so CSS color cascades naturally through fill="currentColor".
- Add src/icon.php helper: reads SVG file, sets width/height to 1em,
injects aria-hidden, supports optional CSS class
- Fix 12 icon SVGs that had hardcoded fill="#000000" or missing fill attr
- Replace search.svg with Phosphor fill-based magnifying glass
- Add explicit SVG sizes for admin header nav icons (16px/20px)
- Scope public search icon CSS to form[role=search]:not(.header-search-form)
to avoid breaking admin header layout; change stroke to fill
- Remove <img> filter: brightness(0) invert(1) hacks from admin.css
125 lines
3.4 KiB
PHP
125 lines
3.4 KiB
PHP
<?php
|
|
/**
|
|
* Markdown cheatsheet — reusable modal dialog loaded via HTMX.
|
|
* Rendered as a <dialog> element; caller should call .showModal() after swap.
|
|
*/
|
|
|
|
$rows = [
|
|
[
|
|
'syntax' => '# Titre 1',
|
|
'render' => '<h1>Titre 1</h1>',
|
|
'note' => 'Un # en début de ligne',
|
|
],
|
|
[
|
|
'syntax' => '## Titre 2',
|
|
'render' => '<h2>Titre 2</h2>',
|
|
'note' => 'Deux ## en début de ligne',
|
|
],
|
|
[
|
|
'syntax' => '### Titre 3',
|
|
'render' => '<h3>Titre 3</h3>',
|
|
'note' => 'Trois ### en début de ligne',
|
|
],
|
|
[
|
|
'syntax' => '**gras**',
|
|
'render' => '<strong>gras</strong>',
|
|
'note' => 'Double astérisque',
|
|
],
|
|
[
|
|
'syntax' => '*italique*',
|
|
'render' => '<em>italique</em>',
|
|
'note' => 'Simple astérisque',
|
|
],
|
|
[
|
|
'syntax' => '~~barré~~',
|
|
'render' => '<del>barré</del>',
|
|
'note' => 'Double tilde',
|
|
],
|
|
[
|
|
'syntax' => '`code`',
|
|
'render' => '<code>code</code>',
|
|
'note' => 'Backticks',
|
|
],
|
|
[
|
|
'syntax' => '[lien](url)',
|
|
'render' => '<a href="#" class="md-cheatsheet-link">lien</a>',
|
|
'note' => 'Texte entre crochets, URL entre parenthèses',
|
|
],
|
|
[
|
|
'syntax' => '',
|
|
'render' => '<span class="md-cheatsheet-img">🖼 image</span>',
|
|
'note' => 'Point d\'exclamation + même syntaxe que lien',
|
|
],
|
|
[
|
|
'syntax' => '> citation',
|
|
'render' => '<blockquote>citation</blockquote>',
|
|
'note' => 'Chevron > en début de ligne',
|
|
],
|
|
[
|
|
'syntax' => '- item',
|
|
'render' => '<ul><li>item</li></ul>',
|
|
'note' => 'Tiret + espace',
|
|
],
|
|
[
|
|
'syntax' => '1. item',
|
|
'render' => '<ol><li>item</li></ol>',
|
|
'note' => 'Chiffre + point + espace',
|
|
],
|
|
[
|
|
'syntax' => '---',
|
|
'render' => '<hr>',
|
|
'note' => 'Triple tiret = ligne horizontale',
|
|
],
|
|
[
|
|
'syntax' => '',
|
|
'render' => '',
|
|
'note' => '',
|
|
],
|
|
[
|
|
'syntax' => 'Texte avec [^1]',
|
|
'render' => 'Texte avec <sup>1</sup>',
|
|
'note' => 'Appel de note de bas de page',
|
|
],
|
|
[
|
|
'syntax' => '[^1]: La note.',
|
|
'render' => '<small>1. La note.</small>',
|
|
'note' => 'Définition de la note (n\'importe où dans le document)',
|
|
],
|
|
];
|
|
?>
|
|
<dialog id="md-cheatsheet-dialog" class="md-cheatsheet-dialog">
|
|
<div class="md-cheatsheet-header">
|
|
<h2>Aide Markdown</h2>
|
|
<button type="button"
|
|
class="admin-icon-btn"
|
|
onclick="this.closest('dialog').close()"
|
|
title="Fermer"
|
|
aria-label="Fermer">
|
|
<?= icon('x-circle') ?>
|
|
</button>
|
|
</div>
|
|
|
|
<table class="md-cheatsheet-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Syntaxe</th>
|
|
<th>Rendu</th>
|
|
<th>Notes</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($rows as $row): ?>
|
|
<?php if ($row['syntax'] === ''): ?>
|
|
<tr class="md-cheatsheet-separator"><td colspan="3"></td></tr>
|
|
<?php else: ?>
|
|
<tr>
|
|
<td class="md-cheatsheet-syntax"><code><?= htmlspecialchars($row['syntax']) ?></code></td>
|
|
<td class="md-cheatsheet-render"><?= $row['render'] ?></td>
|
|
<td class="md-cheatsheet-note"><?= htmlspecialchars($row['note']) ?></td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</dialog>
|