Skip to content

Commit

Permalink
md-editor autoindent was duplicating hr markers
Browse files Browse the repository at this point in the history
only keep characters `>+-*` if there's less than three of them,
and discard entire prefix if there's more

markdown spec only cares about exactly-one or three-or-more, but
let's keep pairs in case anyone use that as unconventional markup
  • Loading branch information
9001 committed Jun 1, 2024
1 parent 5ad6545 commit 692175f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions copyparty/web/md2.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,10 @@ function md_newline() {
var s = linebounds(true),
ln = s.md.substring(s.n1, s.n2),
m1 = /^( *)([0-9]+)(\. +)/.exec(ln),
m2 = /^[ \t>+-]*(\* )?/.exec(ln),
m2 = /^[ \t]*[>+*-]{0,2}[ \t]/.exec(ln),
drop = dom_src.selectionEnd - dom_src.selectionStart;

var pre = m2[0];
var pre = m2 ? m2[0] : '';
if (m1 !== null)
pre = m1[1] + (parseInt(m1[2]) + 1) + m1[3];

Expand Down

0 comments on commit 692175f

Please sign in to comment.