Skip to content

Commit

Permalink
fix: use paragraph token in blockquote in list (#2671)
Browse files Browse the repository at this point in the history
Fixes undefined
  • Loading branch information
UziTech committed Dec 7, 2022
1 parent 697ac2a commit edc857c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Tokenizer.js
Expand Up @@ -149,11 +149,14 @@ export class Tokenizer {
const cap = this.rules.block.blockquote.exec(src);
if (cap) {
const text = cap[0].replace(/^ *>[ \t]?/gm, '');

const top = this.lexer.state.top;
this.lexer.state.top = true;
const tokens = this.lexer.blockTokens(text);
this.lexer.state.top = top;
return {
type: 'blockquote',
raw: cap[0],
tokens: this.lexer.blockTokens(text, []),
tokens,
text
};
}
Expand Down
42 changes: 42 additions & 0 deletions test/unit/Lexer-spec.js
Expand Up @@ -381,6 +381,48 @@ a | b
]
});
});

it('paragraph token in list', () => {
expectTokens({
md: '- > blockquote',
tokens: [
{
type: 'list',
raw: '- > blockquote',
ordered: false,
start: '',
loose: false,
items: [
{
type: 'list_item',
raw: '- > blockquote',
task: false,
checked: undefined,
loose: false,
text: '> blockquote',
tokens: [
{
type: 'blockquote',
raw: '> blockquote',
tokens: [
{
type: 'paragraph',
raw: 'blockquote',
text: 'blockquote',
tokens: [
{ type: 'text', raw: 'blockquote', text: 'blockquote' }
]
}
],
text: 'blockquote'
}
]
}
]
}
]
});
});
});

describe('list', () => {
Expand Down

1 comment on commit edc857c

@vercel
Copy link

@vercel vercel bot commented on edc857c Dec 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.