src/post2html: Disable TeX-style tie parsing in fences

Code fences are meant to indicate literal text, not formatted.
master
Mike Gerwitz 2024-03-17 19:02:27 -04:00
parent 8d45c27edc
commit 88b9b2dee2
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
1 changed files with 4 additions and 3 deletions

View File

@ -98,11 +98,11 @@ prefmt()
}
# ties
{ $0 = gensub( /([^\\])~/, "\\1 ", "g" ) }
{ $0 = gensub( /\\~/, "~", "g" ) }
!infence { $0 = gensub( /([^\\])~/, "\\1 ", "g" ) }
!infence { $0 = gensub( /\\~/, "~", "g" ) }
# TeX-style newline removal
/%$/ {
!infence && /%$/ {
gsub( /%$/, "" )
printf "%s", $0
triml = 1
@ -113,6 +113,7 @@ prefmt()
# code block is HTML and we want to render it as an example)
/^```/ {
gather = !gather
infence = gather
if ( gather ) gblock = ""
}
!/^```/ && gather { gblock = gblock $0 "\n" }