Skip to content

Commit

Permalink
use global replace
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Apr 13, 2024
1 parent caeb6ed commit 6f9a6ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ export class _Tokenizer {
blockquote(src: string): Tokens.Blockquote | undefined {
const cap = this.rules.block.blockquote.exec(src);
if (cap) {
// preceded setext continuation with 4 spaces so it isn't a setext
let text = cap[0].replace(/\n {0,3}((?:=+|-+) *(?:\n|$))/, '\n $1');
// precede setext continuation with 4 spaces so it isn't a setext
let text = cap[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, '\n $1');
text = rtrim(text.replace(/^ *>[ \t]?/gm, ''), '\n');
const top = this.lexer.state.top;
this.lexer.state.top = true;
Expand Down
5 changes: 5 additions & 0 deletions test/specs/new/blockquote_setext.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<blockquote>
<h1>heading 1</h1>
</blockquote>

<blockquote>
<h2>heading 2</h2>
</blockquote>

<blockquote>
<p>not heading 1 == not heading 2 with br<br />--</p>
</blockquote>
5 changes: 5 additions & 0 deletions test/specs/new/blockquote_setext.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
> heading 2
> --
> not heading 1
==
> not heading 2 with br
--

0 comments on commit 6f9a6ff

Please sign in to comment.