Skip to content
Snippets Groups Projects
Unverified Commit 54224826 authored by syuilo's avatar syuilo
Browse files

Resolve #1153

parent cd7f8b08
No related merge requests found
......@@ -9,7 +9,7 @@ export type TextElementQuote = {
};
export default function(text: string) {
const match = text.match(/^"([\s\S]+?)\n"/);
const match = text.match(/^"([\s\S]+?)\n"/) || text.match(/^>([\s\S]+?)\n\n/) || text.match(/^\n>([\s\S]+?)\n\n/) || text.match(/^>([\s\S]+?)$/);
if (!match) return null;
const quote = match[0];
return {
......
......@@ -87,6 +87,20 @@ describe('Text', () => {
], tokens2);
});
it('quote', () => {
const tokens1 = analyze('> foo\nbar\baz');
assert.deepEqual([
{ type: 'quote', content: '> foo\nbar\baz', quote: 'foo\nbar\baz' }
], tokens1);
const tokens2 = analyze('before\n> foo\nbar\baz\n\nafter');
assert.deepEqual([
{ type: 'text', content: 'before' },
{ type: 'quote', content: '\n> foo\nbar\baz\n\n', quote: 'foo\nbar\baz' },
{ type: 'text', content: 'after' }
], tokens2);
});
it('url', () => {
const tokens = analyze('https://himasaku.net');
assert.deepEqual([{
......
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