6493 - browse: '#'s inside lines aren't headings

This commit is contained in:
Kartik Agaram 2020-06-06 11:14:24 -07:00
parent 8f5a26d5c2
commit 0b9cdbd0dd
4 changed files with 18 additions and 11 deletions

View File

@ -83,7 +83,7 @@ $render-normal:flush-buffered-newline: {
}
## end soft newline support
# if start of paragraph and c == '#', switch to header
# if c == '#', switch to header
compare c, 0x23 # '#'
{
break-if-!=

View File

@ -1 +1 @@
Support headers.
Don't treat '#'s inside lines as headers.

View File

@ -63,6 +63,20 @@ $render-normal:loop: {
loop $render-normal:loop
}
}
# if start of paragraph and c == '#', switch to header
compare start-of-paragraph?, 0
{
break-if-=
compare c, 0x23 # '#'
{
break-if-!=
render-header-line fs, state
newline-seen? <- copy 1 # true
loop $render-normal:loop
}
}
# c is not a newline
start-of-paragraph? <- copy 0 # false
# if c is unprintable (particularly a '\r' CR), skip it
compare c, 0x20
loop-if-<
@ -85,15 +99,6 @@ $render-normal:flush-buffered-newline: {
}
## end soft newline support
# if start of paragraph and c == '#', switch to header
compare c, 0x23 # '#'
{
break-if-!=
render-header-line fs, state
newline-seen? <- copy 1 # true
loop $render-normal:loop
}
# if (c == '*') switch to bold
compare c, 0x2a # '*'
{

View File

@ -10,6 +10,8 @@
###### abc
abc # def
abc
def