Un traducteur md -> html minimal en awk - retour accueil
git clone git://bebou.netlib.re/katdown
Log | Files | Refs | README |
commit c52cf9ed415112c07d280c6cd8d505e7e6746070 parent 359e67dfa09eaba3cd67ca5c7e4eecfb0b1a1b40 Auteurice: Arthur Pons <arthur.pons@unistra.fr> Date: Mon, 3 Mar 2025 18:35:53 +0100 Début d'ajout des pre avec des tabulations Pas sûr que ça fonctionne bien Diffstat:
M | katdown | | | 7 | +++++-- |
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/katdown b/katdown @@ -8,8 +8,11 @@ /^### / { print "<h3>" substr($0, 5) "</h3>"; next } /^#### / { print "<h4>" substr($0, 6) "</h4>"; next } /^---+$/ { print "<hr />"; next } -inpre && /^```|^ / { flush(); print "</pre>"; inpre = 0; next } -/^```|^ / { print "<pre>"; inpre = 1; next } +inqpre && /^```/ { flush(); print "</pre>"; intqre = 0; next } +/^```/ { print "<pre>"; inqpre = 1; next } +intpre && /^ / { print substr ($0,1); next } +intpre && /^[^ ]/ { flush(); print "</pre>"; intpre = 0; print substr($0,1); next } +/^ / { print "<pre>"; intpre = 1; print substr ($0,1); next } /^ [-*] / { if (!inul) print "<ul>"; inul = 1; print "<li>" substr($0, 5) "</li>"; next } inul && !/^ [-*] / { print "</ul>"; inul = 0; next } /^ [0-9]+\./ { if (!inol) print "<ol>"; inol = 1; print "<li>" substr($0, length($1)+4) "</li>"; next }