Skip to content

Commit

Permalink
🐛 Vditor 支持
Browse files Browse the repository at this point in the history
SV 模式丢失 headingID
Fix Vanessa219/vditor#546
  • Loading branch information
88250 committed Jul 9, 2020
1 parent be9ec7f commit c76ccfd
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 45 deletions.
4 changes: 2 additions & 2 deletions javascript/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions parse/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (t *Tree) parseBlocks() {
t.Context.FootnotesDefs = []*ast.Node{}
lines := 0
for line := t.lexer.NextLine(); nil != line; line = t.lexer.NextLine() {
if t.Context.Option.VditorWYSIWYG {
if t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV {
ln := []rune(string(line))
if 4 < len(ln) && lex.IsDigit(byte(ln[0])) && ('、' == ln[1] || ')' == ln[1]) {
// 列表标记符自动优化 https://github.com/Vanessa219/vditor/issues/68
Expand Down Expand Up @@ -251,7 +251,7 @@ var blockStarts = []blockStartFunc{
t.Context.advanceOffset(1, true)
markers = append(markers, whitespace)
}
if t.Context.Option.VditorWYSIWYG && !t.Context.Option.VditorSV {
if (t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR) && !t.Context.Option.VditorSV {
// Vditor 所见即所得模式下块引用标记符 > 后面不能为空,但分屏预览模式可以
ln := util.BytesToStr(t.Context.currentLine[t.Context.offset:])
ln = strings.ReplaceAll(ln, util.Caret, "")
Expand Down
2 changes: 1 addition & 1 deletion parse/code_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (context *Context) isFencedCodeClose(tokens []byte, openMarker byte, num in
}
tokens = lex.TrimWhitespace(tokens)
endCaret := bytes.HasSuffix(tokens, util.CaretTokens)
if context.Option.VditorWYSIWYG {
if context.Option.VditorWYSIWYG || context.Option.VditorIR || context.Option.VditorSV {
tokens = bytes.ReplaceAll(tokens, util.CaretTokens, nil)
}
if context.Option.VditorSV && endCaret {
Expand Down
2 changes: 1 addition & 1 deletion parse/delimiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (t *Tree) scanDelims(ctx *InlineContext) *delimiter {
if (lex.ItemAsterisk == token && '~' == tokenBefore) || (lex.ItemTilde == token && '*' == tokenBefore) {
beforeIsPunct = false
}
if t.Context.Option.VditorWYSIWYG {
if t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV {
if util.Caret == string(tokenBefore) {
beforeIsPunct = false
}
Expand Down
34 changes: 23 additions & 11 deletions parse/heading.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func (t *Tree) parseATXHeading() (ok bool, markers, content []byte, level int, id []byte) {
tokens := t.Context.currentLine[t.Context.nextNonspace:]
var startCaret bool
if t.Context.Option.VditorWYSIWYG && bytes.HasPrefix(tokens, util.CaretTokens) {
if (t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV) && bytes.HasPrefix(tokens, util.CaretTokens) {
tokens = bytes.ReplaceAll(tokens, util.CaretTokens, nil)
startCaret = true
}
Expand All @@ -31,7 +31,7 @@ func (t *Tree) parseATXHeading() (ok bool, markers, content []byte, level int, i
}

var inCaret bool
if t.Context.Option.VditorWYSIWYG && bytes.Contains(tokens, []byte("#"+util.Caret+"#")) {
if (t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV) && bytes.Contains(tokens, []byte("#"+util.Caret+"#")) {
tokens = bytes.ReplaceAll(tokens, util.CaretTokens, nil)
inCaret = true
}
Expand All @@ -42,7 +42,7 @@ func (t *Tree) parseATXHeading() (ok bool, markers, content []byte, level int, i
}

var endCaret bool
if t.Context.Option.VditorWYSIWYG && bytes.HasPrefix(tokens[level:], util.CaretTokens) {
if (t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV) && bytes.HasPrefix(tokens[level:], util.CaretTokens) {
tokens = bytes.ReplaceAll(tokens, util.CaretTokens, nil)
endCaret = true
}
Expand Down Expand Up @@ -83,7 +83,7 @@ func (t *Tree) parseATXHeading() (ok bool, markers, content []byte, level int, i
_, content = lex.TrimRight(content)
}

if t.Context.Option.VditorWYSIWYG {
if t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV {
if startCaret || inCaret || endCaret {
content = append(util.CaretTokens, content...)
}
Expand Down Expand Up @@ -113,7 +113,7 @@ func (t *Tree) parseSetextHeading() (level int) {
}

var caretInLn bool
if t.Context.Option.VditorWYSIWYG {
if t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV {
if bytes.Contains(ln, util.CaretTokens) {
caretInLn = true
ln = bytes.ReplaceAll(ln, util.CaretTokens, nil)
Expand Down Expand Up @@ -141,7 +141,7 @@ func (t *Tree) parseSetextHeading() (level int) {
level = 2
}

if t.Context.Option.VditorWYSIWYG && caretInLn {
if (t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV) && caretInLn {
t.Context.oldtip.Tokens = lex.TrimWhitespace(t.Context.oldtip.Tokens)
t.Context.oldtip.AppendTokens(util.CaretTokens)
}
Expand All @@ -150,16 +150,13 @@ func (t *Tree) parseSetextHeading() (level int) {
}

func (t *Tree) parseHeadingID(content []byte) (id []byte) {
if t.Context.Option.VditorWYSIWYG && !t.Context.Option.VditorIR && !t.Context.Option.VditorSV {
content = bytes.ReplaceAll(content, util.CaretTokens, nil)
}

length := len(content)
if 3 > length {
return nil
}

if '}' != content[length-1] {
curlyBracesEnd := bytes.Index(content, []byte("}"))
if 1 > curlyBracesEnd {
return nil
}

Expand All @@ -168,6 +165,21 @@ func (t *Tree) parseHeadingID(content []byte) (id []byte) {
return nil
}

if t.Context.Option.VditorIR || t.Context.Option.VditorSV {
if bytes.HasSuffix(content, util.CaretTokens) {
content = content[:curlyBracesEnd]
content = append(content, util.CaretTokens...)
content = append(content, '}')
}
}
if t.Context.Option.VditorWYSIWYG {
content = bytes.ReplaceAll(content, util.CaretTokens, nil)
}

if length = len(content); '}' != content[length-1] {
return nil
}
curlyBracesStart = bytes.Index(content, []byte("{"))
id = content[curlyBracesStart+1 : length-1]
return
}
4 changes: 2 additions & 2 deletions parse/inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (t *Tree) parseCloseBracket(ctx *InlineContext) *ast.Node {
if passed, remains, dest = t.Context.parseInlineLinkDest(remains); nil == passed {
break
}
if t.Context.Option.VditorWYSIWYG {
if t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV {
if !isImage && nil == opener.node.Next {
break
}
Expand Down Expand Up @@ -198,7 +198,7 @@ func (t *Tree) parseCloseBracket(ctx *InlineContext) *ast.Node {
ctx.pos += len(passed)
matched = isLink && 0 < len(remains)
if matched {
if t.Context.Option.VditorWYSIWYG {
if t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV {
if bytes.HasPrefix(remains, []byte(util.Caret+")")) {
if 0 < len(title) {
// 将 ‸) 换位为 )‸
Expand Down
4 changes: 2 additions & 2 deletions parse/inline_html.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (t *Tree) parseInlineHTML(ctx *InlineContext) (ret *ast.Node) {
tokens := ctx.tokens
caretInTag := false
caretLeftSpace := false
if t.Context.Option.VditorWYSIWYG {
if t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV {
caretIndex := bytes.Index(tokens, util.CaretTokens)
caretInTag = caretIndex > ctx.pos
if caretInTag {
Expand Down Expand Up @@ -109,7 +109,7 @@ func (t *Tree) parseInlineHTML(ctx *InlineContext) (ret *ast.Node) {
if lex.ItemSlash == tokens[0] {
tags = append(tags, tokens[1])
}
if t.Context.Option.VditorWYSIWYG && caretInTag {
if (t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV) && caretInTag {
if !bytes.Contains(tags, []byte(util.CaretReplacement+" ")) && !caretLeftSpace {
tags = bytes.ReplaceAll(tags, []byte("\" "+util.CaretReplacement), []byte("\""+util.CaretReplacement))
}
Expand Down
2 changes: 1 addition & 1 deletion parse/inline_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (context *Context) parseInlineLinkDest(tokens []byte) (passed, remains, des
}

if nil != passed {
if !context.Option.VditorWYSIWYG {
if !context.Option.VditorWYSIWYG && !context.Option.VditorIR && !context.Option.VditorSV {
destination = html.EncodeDestination(html.UnescapeBytes(destination))
}
}
Expand Down
2 changes: 1 addition & 1 deletion parse/inlines.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (t *Tree) walkParseInline(node *ast.Node) {
// 2. 方便后续功能方面的处理,比如 GFM 自动链接解析
t.mergeText(node)

if t.Context.Option.GFMAutoLink && !t.Context.Option.VditorWYSIWYG {
if t.Context.Option.GFMAutoLink && !t.Context.Option.VditorWYSIWYG && !t.Context.Option.VditorIR && !t.Context.Option.VditorSV {
t.parseGFMAutoEmailLink(node)
t.parseGFMAutoLink(node)
}
Expand Down
6 changes: 3 additions & 3 deletions parse/link_ref_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (context *Context) parseLinkTitle(tokens []byte) (validTitle bool, passed,
}
}
if nil != title {
if !context.Option.VditorWYSIWYG {
if !context.Option.VditorWYSIWYG && !context.Option.VditorIR && !context.Option.VditorSV {
title = html.UnescapeBytes(title)
}
}
Expand Down Expand Up @@ -159,7 +159,7 @@ func (context *Context) parseLinkDest(tokens []byte) (ret, remains, destination
ret, remains, destination = context.parseLinkDest2(tokens) // [label](/url)
}
if nil != ret {
if !context.Option.VditorWYSIWYG {
if !context.Option.VditorWYSIWYG && !context.Option.VditorIR && !context.Option.VditorSV {
destination = html.EncodeDestination(html.UnescapeBytes(destination))
}
}
Expand Down Expand Up @@ -310,7 +310,7 @@ func (context *Context) parseLinkLabel(tokens []byte) (n int, remains, label []b
}

label = lex.TrimWhitespace(label)
if !context.Option.VditorWYSIWYG {
if !context.Option.VditorWYSIWYG && !context.Option.VditorIR && !context.Option.VditorSV {
label = lex.ReplaceAll(label, lex.ItemNewline, lex.ItemSpace)
length := len(label)
var token byte
Expand Down
2 changes: 1 addition & 1 deletion parse/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (t *Tree) parseListMarker(container *ast.Node) *ast.ListData {
if !isBlankItem {
// 判断是否是任务列表项
content := ln[t.Context.offset:]
if t.Context.Option.VditorWYSIWYG {
if t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV {
content = bytes.ReplaceAll(content, util.CaretTokens, nil)
}

Expand Down
6 changes: 3 additions & 3 deletions parse/paragraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func paragraphFinalize(p *ast.Node, context *Context) (insertTable bool) {
if listItem := p.Parent; nil != listItem && ast.NodeListItem == listItem.Type && listItem.FirstChild == p {
if 3 == listItem.ListData.Typ {
isTaskListItem := false
if !context.Option.VditorWYSIWYG {
if !(context.Option.VditorWYSIWYG || context.Option.VditorIR || context.Option.VditorSV) {
isTaskListItem = 3 < len(p.Tokens) && lex.IsWhitespace(p.Tokens[3])
} else {
isTaskListItem = 3 <= len(p.Tokens)
Expand All @@ -57,7 +57,7 @@ func paragraphFinalize(p *ast.Node, context *Context) (insertTable bool) {
// 如果是任务列表项则添加任务列表标记符节点
tokens := p.Tokens
var caretStartText, caretAfterCloseBracket, caretInBracket bool
if context.Option.VditorWYSIWYG {
if context.Option.VditorWYSIWYG || context.Option.VditorIR || context.Option.VditorSV {
closeBracket := bytes.IndexByte(tokens, lex.ItemCloseBracket)
if bytes.HasPrefix(tokens, util.CaretTokens) {
tokens = bytes.ReplaceAll(tokens, util.CaretTokens, nil)
Expand All @@ -73,7 +73,7 @@ func paragraphFinalize(p *ast.Node, context *Context) (insertTable bool) {
taskListItemMarker := &ast.Node{Type: ast.NodeTaskListItemMarker, Tokens: tokens[:3], TaskListItemChecked: listItem.ListData.Checked}
p.PrependChild(taskListItemMarker)
p.Tokens = tokens[3:] // 剔除开头的 [ ]、[x] 或者 [X]
if context.Option.VditorWYSIWYG {
if context.Option.VditorWYSIWYG || context.Option.VditorSV {
p.Tokens = bytes.TrimSpace(p.Tokens)
if caretStartText || caretAfterCloseBracket || caretInBracket {
p.Tokens = append([]byte(" "+util.Caret), p.Tokens...)
Expand Down
4 changes: 2 additions & 2 deletions parse/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ func (t *Tree) parseBackslash(block *ast.Node, ctx *InlineContext) *ast.Node {
n.AppendChild(&ast.Node{Type: ast.NodeBackslashContent, Tokens: []byte{token}})
return nil
}
if t.Context.Option.VditorWYSIWYG {
if t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR {
// 处理 \‸x 情况,光标后的字符才是待转义的
tokens := ctx.tokens[ctx.pos:]
caret := util.CaretTokens
if len(caret) < len(tokens) && bytes.HasPrefix(tokens, caret) {
token = ctx.tokens[ctx.pos + len(caret)]
token = ctx.tokens[ctx.pos+len(caret)]
if lex.IsASCIIPunct(token) {
ctx.pos += len(caret)
ctx.pos++
Expand Down
3 changes: 1 addition & 2 deletions parse/thematic_break.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ func (t *Tree) parseThematicBreak() (ok bool, caretTokens []byte) {
markerCnt++
}

if t.Context.Option.VditorWYSIWYG && caretInLn {
if (t.Context.Option.VditorWYSIWYG || t.Context.Option.VditorIR || t.Context.Option.VditorSV) && caretInLn {
caretTokens = util.CaretTokens
}

return 3 <= markerCnt, caretTokens
}
2 changes: 1 addition & 1 deletion parse/toc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (context *Context) parseToC(paragraph *ast.Node) *ast.Node {

content := bytes.TrimSpace(lines[0])
tokens := content
if context.Option.VditorWYSIWYG {
if context.Option.VditorWYSIWYG || context.Option.VditorIR || context.Option.VditorSV {
content = bytes.ReplaceAll(content, util.CaretTokens, nil)
}
if !bytes.EqualFold(content, []byte("[toc]")) {
Expand Down
2 changes: 1 addition & 1 deletion test/spinv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func TestSpinVditorIRDOM(t *testing.T) {
var spinVditorSVDOMTests = []*parseTest{

{"24", "# foo {id‸}", "<div data-block=\"0\" data-type=\"heading\"><span class=\"h1\"><span class=\"vditor-sv__marker--heading\" data-type=\"heading-marker\"># </span><span data-type=\"text\">foo</span><span class=\"vditor-sv__marker\"> {id<wbr>}</span></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></div>"},
{"23", "# foo {id}‸", "<div data-block=\"0\" data-type=\"heading\"><span class=\"h1\"><span class=\"vditor-sv__marker--heading\" data-type=\"heading-marker\"># </span><span data-type=\"text\">foo {id}<wbr></span></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></div>"},
{"23", "# foo {id}‸", "<div data-block=\"0\" data-type=\"heading\"><span class=\"h1\"><span class=\"vditor-sv__marker--heading\" data-type=\"heading-marker\"># </span><span data-type=\"text\">foo</span><span class=\"vditor-sv__marker\"> {id<wbr>}</span></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></div>"},
{"22", "```\nfoo\n```‸", "<div data-block=\"0\" data-type=\"code-block\"><span data-type=\"code-block-open-marker\" class=\"vditor-sv__marker\">```</span><span class=\"vditor-sv__marker--info\" data-type=\"code-block-info\"></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span><span>foo<wbr></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span><span data-type=\"code-block-close-marker\" class=\"vditor-sv__marker\">```</span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></div>"},
{"21", "> foo\n> >‸\n", "<div data-block=\"0\" data-type=\"blockquote\"><span data-type=\"blockquote-line\"><span data-type=\"blockquote-marker\" class=\"vditor-sv__marker\">&gt; </span><span data-type=\"text\">foo</span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></span><span data-type=\"blockquote-line\"><span data-type=\"blockquote-marker\" class=\"vditor-sv__marker\">&gt; </span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></span><span data-type=\"blockquote-line\"><span data-type=\"blockquote-marker\" class=\"vditor-sv__marker\">&gt; </span><span data-type=\"blockquote-marker\" class=\"vditor-sv__marker\">&gt; </span><span data-type=\"text\"><wbr></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></div>"},
{"20", "> >‸", "<div data-block=\"0\" data-type=\"blockquote\"><span data-type=\"blockquote-line\"><span data-type=\"blockquote-marker\" class=\"vditor-sv__marker\">&gt; </span><span data-type=\"blockquote-marker\" class=\"vditor-sv__marker\">&gt; </span><span data-type=\"text\"><wbr></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></span><span data-type=\"newline\"><br /><span style=\"display: none\">\n</span></span></div>"},
Expand Down
10 changes: 5 additions & 5 deletions vditorir.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
// SpinVditorIRDOM 自旋 Vditor Instant-Rendering DOM,用于即时渲染模式下的编辑。
func (lute *Lute) SpinVditorIRDOM(ivHTML string) (ovHTML string) {
lute.VditorIR = true
lute.VditorWYSIWYG = true
lute.VditorWYSIWYG = false
lute.VditorSV = false

// 替换插入符
Expand All @@ -47,7 +47,7 @@ func (lute *Lute) SpinVditorIRDOM(ivHTML string) (ovHTML string) {
// HTML2VditorIRDOM 将 HTML 转换为 Vditor Instant-Rendering DOM,用于即时渲染模式下粘贴。
func (lute *Lute) HTML2VditorIRDOM(sHTML string) (vHTML string) {
lute.VditorIR = true
lute.VditorWYSIWYG = true
lute.VditorWYSIWYG = false
lute.VditorSV = false

markdown, err := lute.HTML2Markdown(sHTML)
Expand All @@ -72,7 +72,7 @@ func (lute *Lute) HTML2VditorIRDOM(sHTML string) (vHTML string) {
// VditorIRDOM2HTML 将 Vditor Instant-Rendering DOM 转换为 HTML,用于 Vditor.getHTML() 接口。
func (lute *Lute) VditorIRDOM2HTML(vhtml string) (sHTML string) {
lute.VditorIR = true
lute.VditorWYSIWYG = true
lute.VditorWYSIWYG = false
lute.VditorSV = false

markdown := lute.vditorIRDOM2Md(vhtml)
Expand All @@ -83,7 +83,7 @@ func (lute *Lute) VditorIRDOM2HTML(vhtml string) (sHTML string) {
// Md2VditorIRDOM 将 markdown 转换为 Vditor Instant-Rendering DOM,用于从源码模式切换至即时渲染模式。
func (lute *Lute) Md2VditorIRDOM(markdown string) (vHTML string) {
lute.VditorIR = true
lute.VditorWYSIWYG = true
lute.VditorWYSIWYG = false
lute.VditorSV = false

tree := parse.Parse("", []byte(markdown), lute.Options)
Expand All @@ -102,7 +102,7 @@ func (lute *Lute) Md2VditorIRDOM(markdown string) (vHTML string) {
// VditorIRDOM2Md 将 Vditor Instant-Rendering DOM 转换为 markdown,用于从即时渲染模式切换至源码模式。
func (lute *Lute) VditorIRDOM2Md(htmlStr string) (markdown string) {
lute.VditorIR = true
lute.VditorWYSIWYG = true
lute.VditorWYSIWYG = false
lute.VditorSV = false

htmlStr = strings.ReplaceAll(htmlStr, parse.Zwsp, "")
Expand Down
6 changes: 3 additions & 3 deletions vditorsv.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
// SpinVditorSVDOM 自旋 Vditor Split-View DOM,用于分屏预览模式下的编辑。
func (lute *Lute) SpinVditorSVDOM(markdown string) (ovHTML string) {
lute.VditorSV = true
lute.VditorWYSIWYG = true
lute.VditorWYSIWYG = false
lute.VditorIR = false

tree := parse.Parse("", []byte(markdown), lute.Options)
Expand All @@ -39,7 +39,7 @@ func (lute *Lute) SpinVditorSVDOM(markdown string) (ovHTML string) {
// HTML2VditorSVDOM 将 HTML 转换为 Vditor Split-View DOM,用于分屏预览模式下粘贴。
func (lute *Lute) HTML2VditorSVDOM(sHTML string) (vHTML string) {
lute.VditorSV = true
lute.VditorWYSIWYG = true
lute.VditorWYSIWYG = false
lute.VditorIR = false

markdown, err := lute.HTML2Markdown(sHTML)
Expand All @@ -64,7 +64,7 @@ func (lute *Lute) HTML2VditorSVDOM(sHTML string) (vHTML string) {
// Md2VditorSVDOM 将 markdown 转换为 Vditor Split-View DOM,用于从源码模式切换至分屏预览模式。
func (lute *Lute) Md2VditorSVDOM(markdown string) (vHTML string) {
lute.VditorSV = true
lute.VditorWYSIWYG = true
lute.VditorWYSIWYG = false
lute.VditorIR = false

tree := parse.Parse("", []byte(markdown), lute.Options)
Expand Down

0 comments on commit c76ccfd

Please sign in to comment.