diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-06-06 11:14:24 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-06-06 11:14:24 -0700 |
commit | 0b9cdbd0dd33af48746de83c00785daa293db975 (patch) | |
tree | cd7b10620b9002398dd2e32faa68f05da423cb48 /prototypes | |
parent | 8f5a26d5c29e9fbf082391ab6a9dcd4fba95942e (diff) | |
download | mu-0b9cdbd0dd33af48746de83c00785daa293db975.tar.gz |
6493 - browse: '#'s inside lines aren't headings
Diffstat (limited to 'prototypes')
-rw-r--r-- | prototypes/browse/26-headers/main.mu | 2 | ||||
-rw-r--r-- | prototypes/browse/27/README.md | 2 | ||||
-rw-r--r-- | prototypes/browse/27/main.mu | 23 | ||||
-rw-r--r-- | prototypes/browse/test1.md | 2 |
4 files changed, 18 insertions, 11 deletions
diff --git a/prototypes/browse/26-headers/main.mu b/prototypes/browse/26-headers/main.mu index 463b018f..4f6b53e3 100644 --- a/prototypes/browse/26-headers/main.mu +++ b/prototypes/browse/26-headers/main.mu @@ -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-!= diff --git a/prototypes/browse/27/README.md b/prototypes/browse/27/README.md index 6abb7af9..09813c57 100644 --- a/prototypes/browse/27/README.md +++ b/prototypes/browse/27/README.md @@ -1 +1 @@ -Support headers. +Don't treat '#'s inside lines as headers. diff --git a/prototypes/browse/27/main.mu b/prototypes/browse/27/main.mu index c6272343..48664533 100644 --- a/prototypes/browse/27/main.mu +++ b/prototypes/browse/27/main.mu @@ -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 # '*' { diff --git a/prototypes/browse/test1.md b/prototypes/browse/test1.md index 850edc90..c639f8a3 100644 --- a/prototypes/browse/test1.md +++ b/prototypes/browse/test1.md @@ -10,6 +10,8 @@ ###### abc +abc # def + abc def |