Add more edge cases to code and header handling
This commit is contained in:
parent
da65bb16f0
commit
2f982164ef
2 changed files with 12 additions and 1 deletions
|
@ -5,6 +5,7 @@ BEGIN {
|
|||
|
||||
function parse_header(str, hnum, content) {
|
||||
if (substr(str, 1, 1) == "#") {
|
||||
gsub(/ *#* *$/, "", str);
|
||||
match(str, /#+/);
|
||||
hnum = RLENGTH;
|
||||
|
||||
|
@ -364,7 +365,7 @@ function parse_block(str) {
|
|||
}
|
||||
|
||||
function line_continues(body, line) {
|
||||
if (match(body, /^ /) && match(line, /^ /))
|
||||
if (match(body, /^ /) && (match(line, /^ /) || line == ""))
|
||||
return 1;
|
||||
|
||||
if (match(body, /^```\n/) && !match(body, /\n```$/))
|
||||
|
|
10
test.sh
10
test.sh
|
@ -86,6 +86,12 @@ check <<-EOF
|
|||
<h3>Header3</h3>
|
||||
EOF
|
||||
|
||||
check <<-EOF
|
||||
# Header ###
|
||||
---
|
||||
<h1>Header</h1>
|
||||
EOF
|
||||
|
||||
check <<-EOF
|
||||
underlined header 1
|
||||
===================
|
||||
|
@ -150,11 +156,15 @@ EOF
|
|||
|
||||
check <<-"EOF"
|
||||
code
|
||||
|
||||
indented by
|
||||
|
||||
spaces
|
||||
---
|
||||
<pre><code>code
|
||||
|
||||
indented by
|
||||
|
||||
spaces</code></pre>
|
||||
EOF
|
||||
|
||||
|
|
Loading…
Reference in a new issue