docs: make curldown do angle brackets like markdown

Make sure we use \< and \> in markdown all over so that it renders
correctly, on GitHub and elsewhere. cd2nroff now outputs a warning if it
finds an unescaled angle bracket.

Ref: #12854
Closes #12869
This commit is contained in:
Daniel Stenberg 2024-02-05 23:23:56 +01:00
parent 80944740e5
commit d94733b447
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
26 changed files with 78 additions and 68 deletions

View file

@ -243,11 +243,20 @@ sub single {
next;
}
# remove single line HTML comments
$d =~ s/<!--.*?-->//g;
# **bold**
$d =~ s/\*\*(\S.*?)\*\*/\\fB$1\\fP/g;
# *italics*
$d =~ s/\*(\S.*?)\*/\\fI$1\\fP/g;
if($d =~ /[^\\][\<\>]/) {
print STDERR "$f:$line:1:WARN: un-escaped < or > used\n";
}
# convert backslash-'<' or '> to just the second character
$d =~ s/\\([<<])/$1/g;
# mentions of curl symbols with man pages use italics by default
$d =~ s/((lib|)curl([^ ]*\(3\)))/\\fI$1\\fP/gi;
@ -307,9 +316,6 @@ sub single {
$blankline = 0;
$header = 0;
# remove single line HTML comments
$d =~ s/<!--.*?-->//g;
# quote minuses in the output
$d =~ s/([^\\])-/$1\\-/g;
# replace single quotes