mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: implement switchable task list node
This commit is contained in:
23
plugin/gomark/ast/utils.go
Normal file
23
plugin/gomark/ast/utils.go
Normal file
@ -0,0 +1,23 @@
|
||||
package ast
|
||||
|
||||
func FindPrevSiblingExceptLineBreak(node Node) Node {
|
||||
if node == nil {
|
||||
return nil
|
||||
}
|
||||
prev := node.PrevSibling()
|
||||
if prev != nil && prev.Type() == LineBreakNode {
|
||||
return FindPrevSiblingExceptLineBreak(prev)
|
||||
}
|
||||
return prev
|
||||
}
|
||||
|
||||
func FindNextSiblingExceptLineBreak(node Node) Node {
|
||||
if node == nil {
|
||||
return nil
|
||||
}
|
||||
next := node.NextSibling()
|
||||
if next != nil && next.Type() == LineBreakNode {
|
||||
return FindNextSiblingExceptLineBreak(next)
|
||||
}
|
||||
return next
|
||||
}
|
Reference in New Issue
Block a user