attrib = gensub(/^:::+[ \t]*\{?[ \t]*([^\}\n]*)\}?[ \t]*\n.*$/, "\\1", 1, block);
gsub(/[^a-zA-Z0-9_-]+/, " ", attrib);
gsub(/(^ | $)/, "", attrib);
- if ( match(code, "(^|\n)" guard "+(\n|$)" ) ) {
+ if ( match(code, "(^|\n)" guard "+(\n|$)" ) && attrib ) {
len = RLENGTH; st = RSTART;
return "<div class=\"" attrib "\">" _nblock( substr(code, 1, st - 1) ) "</div>\n" \
_block( substr( code, st + len ) );
+ } else if ( match(code, "(^|\n)" guard "+(\n|$)" ) ) {
+ len = RLENGTH; st = RSTART;
+ return "<div>" _nblock( substr(code, 1, st - 1) ) "</div>\n" \
+ _block( substr( code, st + len ) );
} else {
match( block, /(^|\n)[[:space:]]*(\n|$)/ ) || match( block, /$/ );
len = RLENGTH; st = RSTART;
attrib = gensub(/^(~~~+|```+)[ \t]*\{?[ \t]*([^\}\n]*)\}?[ \t]*\n.*$/, "\\2", 1, block);
gsub(/[^a-zA-Z0-9_-]+/, " ", attrib);
gsub(/(^ | $)/, "", attrib);
- if ( match(code, "(^|\n)" guard "+(\n|$)" ) ) {
+ if ( match(code, "(^|\n)" guard "+(\n|$)" ) && attrib ) {
len = RLENGTH; st = RSTART;
return "<pre><code class=\"" attrib "\">" HTML( substr(code, 1, st - 1) ) "</code></pre>\n" \
_block( substr( code, st + len ) );
+ } else if ( match(code, "(^|\n)" guard "+(\n|$)" ) ) {
+ len = RLENGTH; st = RSTART;
+ return "<pre><code>" HTML( substr(code, 1, st - 1) ) "</code></pre>\n" \
+ _block( substr( code, st + len ) );
} else {
match( block, /(^|\n)[[:space:]]*(\n|$)/ ) || match( block, /$/ );
len = RLENGTH; st = RSTART;