Better support for horizontal rules

This commit is contained in:
Konstantin Nazarov 2021-07-31 08:55:44 +00:00
parent 29281f3d61
commit d97f7044ed
Signed by: knazarov
GPG key ID: 4CFE0A42FA409C22
2 changed files with 22 additions and 3 deletions

View file

@ -240,6 +240,22 @@ function escape_text(str) {
return str;
}
function extract_emphasis(str, i, sstr, arr, num, c) {
sstr=substr(str, i, length(str) - i + 1);
c = ""
if (match(sstr, /^\*{1,3}[^\*]/)) {
c = "*";
num = RLENGTH;
}
if (match(sstr, /^_{1,3}[^_]/)) {
c = "_";
num = RLENGTH;
}
}
function parse_line(str, result, end, i, c) {
result = ""
@ -383,9 +399,9 @@ function parse_block(str) {
return parse_blockquote(str);
}
else if ( \
match(str, /^[[:space:]]*\*[[:space:]]*\*[[:space:]]*\*[[:space:]]*$/) ||
match(str, /^[[:space:]]*-[[:space:]]*-[[:space:]]*-[[:space:]]*$/) ||
match(str, /^[[:space:]]*_[[:space:]]*_[[:space:]]*_[[:space:]]*$/)) {
match(str, /^([[:space:]]*\*){3,}[[:space:]]*$/) ||
match(str, /^([[:space:]]*-){3,}[[:space:]]*$/) ||
match(str, /^([[:space:]]*_){3,}[[:space:]]*$/)) {
return "<hr />";
}
else if (match(str, /^[-+*][[:space:]]/) || match(str, /^[[:digit:]]\.[[:space:]]/)) {

View file

@ -440,11 +440,14 @@ Horizontal rules:
* * *
_ _ _
********
---
<p>Horizontal rules:</p>
<hr />
<hr />
<hr />
<hr />
EOF
echo