mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 04:31:50 +08:00
🐛 Query embed block scripts to be correctly escaped when exporting templates https://github.com/siyuan-note/siyuan/issues/13701
This commit is contained in:
parent
07cd4ec0b5
commit
1c0b2a3def
@ -188,12 +188,16 @@ func DocSaveAsTemplate(id, name string, overwrite bool) (code int, err error) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
// Code content in templates is not properly escaped https://github.com/siyuan-note/siyuan/issues/9649
|
||||
// Content in templates is not properly escaped
|
||||
// https://github.com/siyuan-note/siyuan/issues/9649
|
||||
// https://github.com/siyuan-note/siyuan/issues/13701
|
||||
switch n.Type {
|
||||
case ast.NodeCodeBlockCode:
|
||||
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("""), []byte("\""))
|
||||
case ast.NodeCodeSpanContent:
|
||||
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("""), []byte("\""))
|
||||
case ast.NodeBlockQueryEmbedScript:
|
||||
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("""), []byte("\""))
|
||||
case ast.NodeTextMark:
|
||||
if n.IsTextMarkType("code") {
|
||||
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, """, "\"")
|
||||
|
Loading…
Reference in New Issue
Block a user