mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-07 13:20:16 +01:00
✨ 行级元素支持多重样式类型 https://github.com/siyuan-note/siyuan/issues/2911
This commit is contained in:
parent
dcee38bcfa
commit
c5f0b96929
13 changed files with 133 additions and 85 deletions
|
|
@ -237,23 +237,18 @@ func renderTemplate(p, id string) (string, error) {
|
|||
}
|
||||
|
||||
func appendRefTextRenderResultForBlockRef(blockRef *ast.Node) {
|
||||
if ast.NodeBlockRef != blockRef.Type {
|
||||
if !treenode.IsBlockRef(blockRef) {
|
||||
return
|
||||
}
|
||||
|
||||
refText := blockRef.ChildByType(ast.NodeBlockRefText)
|
||||
if nil != refText {
|
||||
return
|
||||
}
|
||||
refText = blockRef.ChildByType(ast.NodeBlockRefDynamicText)
|
||||
if nil != refText {
|
||||
refID, text, _ := treenode.GetBlockRef(blockRef)
|
||||
if "" != text {
|
||||
return
|
||||
}
|
||||
|
||||
// 动态解析渲染 ((id)) 的锚文本
|
||||
// 现行版本已经不存在该语法情况,这里保留是为了迁移历史数据
|
||||
refID := blockRef.ChildByType(ast.NodeBlockRefID)
|
||||
text := sql.GetRefText(refID.TokensStr())
|
||||
text = sql.GetRefText(refID)
|
||||
if Conf.Editor.BlockRefDynamicAnchorTextMaxLen < utf8.RuneCountInString(text) {
|
||||
text = gulu.Str.SubStr(text, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) + "..."
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue