]> git.plutz.net Git - cgilite/commitdiff
use attributes in wrapper class for fenced code blocks master
authorPaul Hänsch <paul@plutz.net>
Mon, 7 Jul 2025 03:50:05 +0000 (05:50 +0200)
committerPaul Hänsch <paul@plutz.net>
Mon, 7 Jul 2025 03:50:05 +0000 (05:50 +0200)
markdown.awk
tests-markdown.sh

index 90dddbf7a7ced80503c48a5f8d480fe4208e21dd..60599af75be01440912566a8b0b5349242d34ec6 100755 (executable)
@@ -657,7 +657,8 @@ function _block( block, LOCAL, st, len, text, title, attrib, href, guard, code,
       gsub(/(^ | $)/, "", attrib);
       if ( match(code, "(^|\n)" guard "+(\n|$)" ) && attrib ) {
         len = RLENGTH; st = RSTART;
-        ret = ret "<pre><code class=\"" attrib "\">" HTML( substr(code, 1, st - 1) ) "</code></pre>\n";
+        ret = ret "<pre class=\"" attrib "\"><code class=\"" attrib "\">" \
+                        HTML( substr(code, 1, st - 1) ) "</code></pre>\n";
         block = substr( code, st + len );
         continue;
 
index 6df4224d131d6beb7d2f1cab50ab2953517f18aa..30442cc225fbbf9a4cc23e59d4db5a08933c3d97 100755 (executable)
@@ -185,7 +185,7 @@ not be
 *formatted*
 but &shy; <escaped>
 ```' \
-'<pre><code class="tag code">fenced code will
+'<pre class="tag code"><code class="tag code">fenced code will
 not be
 *formatted*
 but &amp;shy; &lt;escaped&gt;</code></pre>' \
@@ -762,7 +762,7 @@ list item.</p>
 </ul>
 <hr>
 
-<pre><code class="blue">Fenced Code Block
+<pre class="blue"><code class="blue">Fenced Code Block
 # with verbatim Text
 `and an attribute`</code></pre>
 <div class="line-block">The limerick packs laughs anatomical<br>