fix: trim newline from blockquote token.text (#3037)
This commit is contained in:
parent
bbce7dd0c2
commit
92033e57c8
@ -156,7 +156,7 @@ export class _Tokenizer {
|
|||||||
blockquote(src: string): Tokens.Blockquote | undefined {
|
blockquote(src: string): Tokens.Blockquote | undefined {
|
||||||
const cap = this.rules.block.blockquote.exec(src);
|
const cap = this.rules.block.blockquote.exec(src);
|
||||||
if (cap) {
|
if (cap) {
|
||||||
const text = cap[0].replace(/^ *>[ \t]?/gm, '');
|
const text = rtrim(cap[0].replace(/^ *>[ \t]?/gm, ''), '\n');
|
||||||
const top = this.lexer.state.top;
|
const top = this.lexer.state.top;
|
||||||
this.lexer.state.top = true;
|
this.lexer.state.top = true;
|
||||||
const tokens = this.lexer.blockTokens(text);
|
const tokens = this.lexer.blockTokens(text);
|
||||||
|
@ -382,6 +382,27 @@ a | b
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('trim newline in text', () => {
|
||||||
|
expectTokens({
|
||||||
|
md: '> blockquote\n',
|
||||||
|
tokens: [
|
||||||
|
{
|
||||||
|
type: 'blockquote',
|
||||||
|
raw: '> blockquote\n',
|
||||||
|
text: 'blockquote',
|
||||||
|
tokens: [{
|
||||||
|
type: 'paragraph',
|
||||||
|
raw: 'blockquote',
|
||||||
|
text: 'blockquote',
|
||||||
|
tokens: [
|
||||||
|
{ type: 'text', raw: 'blockquote', text: 'blockquote' }
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('paragraph token in list', () => {
|
it('paragraph token in list', () => {
|
||||||
expectTokens({
|
expectTokens({
|
||||||
md: '- > blockquote',
|
md: '- > blockquote',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user