коммит произвёл
GitHub
родитель
b45ff0be5d
Коммит
717a4d04a9
@@ -5,7 +5,7 @@ package markdown
|
||||
|
||||
// Inspect traverses the markdown tree in depth-first order. If f returns true, Inspect invokes f
|
||||
// recursively for each child of the block or inline, followed by a call of f(nil).
|
||||
func Inspect(markdown string, f func(interface{}) bool) {
|
||||
func Inspect(markdown string, f func(any) bool) {
|
||||
document, referenceDefinitions := Parse(markdown)
|
||||
InspectBlock(document, func(block Block) bool {
|
||||
if !f(block) {
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestInspect(t *testing.T) {
|
||||
|
||||
visited := []string{}
|
||||
level := 0
|
||||
Inspect(markdown, func(blockOrInline interface{}) bool {
|
||||
Inspect(markdown, func(blockOrInline any) bool {
|
||||
if blockOrInline == nil {
|
||||
level--
|
||||
} else {
|
||||
@@ -67,7 +67,7 @@ Some bold text **Text for markdown?** to go with it.
|
||||
At the end, some more lines`
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
Inspect(text, func(_ interface{}) bool {
|
||||
Inspect(text, func(_ any) bool {
|
||||
counterSink++
|
||||
return true
|
||||
})
|
||||
|
||||
@@ -99,7 +99,7 @@ func TestTextRanges(t *testing.T) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
var ranges []Range
|
||||
var values []string
|
||||
Inspect(tc.Markdown, func(node interface{}) bool {
|
||||
Inspect(tc.Markdown, func(node any) bool {
|
||||
if textNode, ok := node.(*Text); ok {
|
||||
ranges = append(ranges, textNode.Range)
|
||||
values = append(values, textNode.Text)
|
||||
|
||||
Ссылка в новой задаче
Block a user