Skip to content

Commit 3fb0d32

Browse files
authored
fix: handle CRLF input (#242)
1 parent 670ae4e commit 3fb0d32

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

workspace/aubade/src/artisan/example.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,8 @@ describe('spec', ({ concurrent: it }) => {
670670

671671
describe('libretto', ({ concurrent: it }) => {
672672
const suite: Record<string, [string, string]> = {
673+
'crlf#paragraph': ['aaa\r\n\r\nbbb', '<p>aaa</p>\n<p>bbb</p>'],
674+
673675
'comment#block/1': ['<!-- comment -->', ''],
674676
'comment#block/2': ['<!---\ncomment\n--->', ''],
675677
'comment#block/3': ['<!-- comment with -- is fine -->', ''],

workspace/aubade/src/artisan/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function forge({ directive = {}, renderer = {}, quotes }: Options = {}) {
5959
}
6060

6161
return (input: string) => {
62-
let { children: stream } = compose(input);
62+
let { children: stream } = compose(input.replace(/\r\n?/g, '\n'));
6363

6464
if (quotes === 'typographic') {
6565
stream = stream.map((t) => walk(t, { 'inline:text': typographic }));

0 commit comments

Comments
 (0)