Add support for horizontal rules
This commit is contained in:
parent
b54918c9b0
commit
0ebdbe72c4
2 changed files with 21 additions and 0 deletions
|
@ -354,6 +354,12 @@ function parse_block(str) {
|
|||
else if (substr(str, 1, 1) == ">") {
|
||||
return parse_blockquote(str);
|
||||
}
|
||||
else if ( \
|
||||
match(str, /^[[:space:]]*\*[[:space:]]*\*[[:space:]]*\*[[:space:]]*$/) ||
|
||||
match(str, /^[[:space:]]*-[[:space:]]*-[[:space:]]*-[[:space:]]*$/) ||
|
||||
match(str, /^[[:space:]]*_[[:space:]]*_[[:space:]]*_[[:space:]]*$/)) {
|
||||
return "<hr />";
|
||||
}
|
||||
else if (match(str, /^[-+*][[:space:]]/) || match(str, /^[[:digit:]]\.[[:space:]]/)) {
|
||||
return parse_list(str);
|
||||
}
|
||||
|
|
15
test.sh
15
test.sh
|
@ -423,5 +423,20 @@ Link with title: [foo](/bar "baz")
|
|||
<p>Link with title: <a href="/bar" title="baz">foo</a></p>
|
||||
EOF
|
||||
|
||||
check <<-"EOF"
|
||||
Horizontal rules:
|
||||
|
||||
- - -
|
||||
|
||||
* * *
|
||||
|
||||
_ _ _
|
||||
---
|
||||
<p>Horizontal rules:</p>
|
||||
<hr />
|
||||
<hr />
|
||||
<hr />
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "All tests passed"
|
||||
|
|
Loading…
Reference in a new issue