Skip to content

Commit

Permalink
🎨 Vditor 支持
Browse files Browse the repository at this point in the history
SV 模式块引用嵌套列表、代码块问题
Vanessa219/vditor#567
  • Loading branch information
88250 committed Jul 12, 2020
1 parent 6879f4e commit da8b602
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 41 deletions.
2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

40 changes: 0 additions & 40 deletions render/vditor_sv_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,51 +831,11 @@ func (r *VditorSVRenderer) renderBlockquote(node *ast.Node, entering bool) ast.W

bq := node.ParentIs(ast.NodeBlockquote)
buf := writer.Bytes()
//lines := bytes.Split(buf, newline)
//length := len(lines)
//if 1 == len(r.nodeWriterStack) { // 已经是根这一层
// length = len(lines)
// if 1 < length && lex.IsBlank(lines[length-1]) {
// lines = lines[:length-1]
// }
//}

//blockquoteLines := bytes.Buffer{}
//length = len(lines)
//for i, line := range lines {
// if bytes.Equal(line, []byte("</span>")) {
// blockquoteLines.Write(line)
// blockquoteLines.Write(newline)
// continue
// }
// if bytes.HasPrefix(line,[]byte("</span>")) {
// blockquoteLines.Write([]byte("</span>"))
// line = line[len("</span>"):]
// }
// if 0 == len(line) {
// if 0 == i {
// continue
// }
//
// if !bytes.HasSuffix(blockquoteLines.Bytes(), newline) && i < length-1 {
// blockquoteLines.WriteString(`<span data-type="blockquote-marker" class="vditor-sv__marker">&gt; </span>`)
// blockquoteLines.Write(newline)
// }
// continue
// }
//
// blockquoteLines.WriteString(`<span data-type="blockquote-marker" class="vditor-sv__marker">&gt; </span>`)
// blockquoteLines.Write(line)
// blockquoteLines.Write(newline)
//}
//buf = blockquoteLines.Bytes()

buf = bytes.TrimPrefix(buf, newline)
buf = bytes.TrimSuffix(buf, newline)
marker := []byte("<span data-type=\"blockquote-marker\" class=\"vditor-sv__marker\">&gt; </span>")
buf = append(marker, buf...)
buf = bytes.ReplaceAll(buf, newline, append(newline, []byte("<span data-type=\"blockquote-marker\" class=\"vditor-sv__marker\">&gt; </span>")...))

writer.Reset()
inListItem := r.inListItem(node)
if !bq && !inListItem {
Expand Down

0 comments on commit da8b602

Please sign in to comment.