Project Files
src / pedagogie.ts
// Page « pourquoi on fait ça » â destinĂ©e aux parents et enseignant·e·s.
// Route : GET /pedagogie (pas de lien depuis le chat enfant, URL Ă partager
// Ă la main).
//
// Source de vérité unique : PEDAGOGIE.md à la racine du projet. Le markdown
// est inliné dans data.ts par scripts/inline-data.mjs au build, puis rendu
// en HTML via la lib `marked`. Si tu veux modifier le contenu de la page,
// édite PEDAGOGIE.md et relance `npm run inline-data` (ou `npm run build`).
import { marked } from "marked";
import { PEDAGOGIE_MD } from "./data";
// Configure le renderer une seule fois au load. GitHub-Flavored Markdown
// (gfm:true) â tables, code fences, links. Pas de mode async pour ne pas
// avoir à gérer la promesse à chaque GET /pedagogie.
marked.setOptions({ gfm: true, breaks: false });
// On rend une seule fois au démarrage (PEDAGOGIE_MD est figé au build).
// Si tu veux du dynamisme (rendu Ă chaque GET), supprime la cache.
const bodyHtml = marked.parse(PEDAGOGIE_MD, { async: false }) as string;
// CSS volontairement repris du fichier d'origine â palette beige Georgia
// pour cohérence avec les autres pages d'admin / catalogue. Le markdown
// rendu par marked produit du <h1>, <h2>, <p>, <table>, etc. ; on style ces
// éléments génériques.
const STYLES = `
:root {
--bg:#f7f5ef; --card:#ffffff; --ink:#1f1f1f; --muted:#6b6b6b;
--line:#e5e1d6; --accent:#1565c0; --good:#2e7d32; --warn:#c62828;
--soft:#fafaf6; --quote:#5a5a5a;
}
* { box-sizing:border-box; }
html, body { margin:0; padding:0; background:var(--bg); color:var(--ink);
font-family: "Georgia", "Times New Roman", serif; line-height:1.65; }
body { padding:48px 20px 80px; }
.wrap { max-width:760px; margin:0 auto; }
h1 { font-size:28px; margin:0 0 8px; font-weight:600; letter-spacing:-0.01em;
line-height:1.25; padding-bottom:18px; border-bottom:2px solid var(--line);
margin-bottom:24px; }
h1 + p em, h1 + p { font-size:16px; color:var(--muted); margin:0 0 14px;
font-style:italic; }
h2 { font-size:20px; margin:38px 0 14px; font-weight:600; letter-spacing:-0.005em;
border-left:3px solid var(--ink); padding-left:14px; }
h3 { font-size:15px; margin:24px 0 8px; font-weight:600; color:var(--ink);
font-family:-apple-system,BlinkMacSystemFont,sans-serif; }
p { margin:0 0 14px; font-size:16px; }
ul, ol { margin:0 0 16px; padding-left:24px; }
li { margin-bottom:6px; }
blockquote { margin:18px 0; padding:14px 20px; border-left:3px solid var(--accent);
background:var(--card); color:var(--quote); font-style:italic;
border-radius:0 6px 6px 0; }
blockquote p { margin:0; }
blockquote p + p { margin-top:8px; }
table { width:100%; border-collapse:collapse; margin:18px 0; background:var(--card);
border:1px solid var(--line); border-radius:8px; overflow:hidden; }
th, td { padding:10px 14px; text-align:left; font-size:14px;
border-bottom:1px solid var(--line); vertical-align:top; }
th { background:var(--soft); font-weight:600; color:var(--muted); font-size:12px;
text-transform:uppercase; letter-spacing:.04em; }
tr:last-child td { border-bottom:0; }
code { background:#ede9dc; padding:1px 6px; border-radius:3px; font-size:13px;
font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
pre { background:var(--soft); border:1px dashed var(--line); border-radius:6px;
padding:14px 18px; overflow-x:auto; font-size:13px; }
pre code { background:transparent; padding:0; }
a { color:var(--accent); }
hr { border:0; border-top:1px solid var(--line); margin:32px 0; }
strong { font-weight:600; }
em { font-style:italic; }
/* Le footer en italique Ă la fin de PEDAGOGIE.md */
p > em:only-child { color:var(--muted); font-size:13px; }
`;
export function buildPedagogiePage(): string {
return `<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Livre dont vous ĂȘtes le hĂ©ros â Philo Bac · pourquoi ce dispositif</title>
<meta name="robots" content="noindex,nofollow">
<style>${STYLES}</style>
</head>
<body><div class="wrap">
${bodyHtml}
</div></body>
</html>`;
}