Skip to content

Commit

Permalink
🎨 Vditor 支持 Vanessa219/vditor#93
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jan 29, 2020
1 parent cc216dd commit 5ffefa5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
12 changes: 11 additions & 1 deletion heading.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ func (t *Tree) parseSetextHeading() (level int) {
return
}

var caretInLn bool
if t.context.option.VditorWYSIWYG {
ln = bytes.ReplaceAll(ln, []byte(caret), []byte(""))
if bytes.Contains(ln, []byte(caret)) {
caretInLn = true
ln = bytes.ReplaceAll(ln, []byte(caret), []byte(""))
}
}

markers := 0
Expand All @@ -109,5 +113,11 @@ func (t *Tree) parseSetextHeading() (level int) {
if itemHyphen == marker {
level = 2
}

if t.context.option.VditorWYSIWYG && caretInLn {
t.context.oldtip.tokens = trimWhitespace(t.context.oldtip.tokens)
t.context.oldtip.AppendTokens([]byte(caret))
}

return
}
Loading

0 comments on commit 5ffefa5

Please sign in to comment.