Skip to content
Snippets Groups Projects
Commit e67d14b8 authored by marihachi's avatar marihachi
Browse files

resolve #46

parent c4ecdb36
No related branches found
No related tags found
No related merge requests found
...@@ -85,15 +85,26 @@ block ...@@ -85,15 +85,26 @@ block
// block: quote // block: quote
quote quote
= lines:quoteLine+ = head:quoteMultiLine tails:quoteMultiLine+
{ {
const children = applyParser(lines.join('\n'), 'fullParser'); const children = applyParser([head, ...tails].join('\n'), 'fullParser');
return QUOTE(children);
}
/ line:quoteLine
{
const children = applyParser(line, 'fullParser');
return QUOTE(children); return QUOTE(children);
} }
quoteMultiLine
= quoteLine / quoteEmptyLine
quoteLine quoteLine
= BEGIN ">" _? text:$(CHAR+) END { return text; } = BEGIN ">" _? text:$(CHAR+) END { return text; }
quoteEmptyLine
= BEGIN ">" _? END { return ''; }
// block: search // block: search
search search
......
...@@ -89,6 +89,26 @@ describe('FullParser', () => { ...@@ -89,6 +89,26 @@ describe('FullParser', () => {
]; ];
assert.deepStrictEqual(mfm.parse(input), output); assert.deepStrictEqual(mfm.parse(input), output);
}); });
it('複数行の引用ブロックでは空行を含めることができる', () => {
const input = `
> abc
>
> 123
`;
const output = [
QUOTE([
TEXT('abc\n\n123')
])
];
assert.deepStrictEqual(mfm.parse(input), output);
});
it('1行の引用ブロックを空行にはできない', () => {
const input = `> `;
const output = [
TEXT('> ')
];
assert.deepStrictEqual(mfm.parse(input), output);
});
}); });
describe('search', () => { describe('search', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment