Does Obsidian or Codemirror optimizes render of invisible parts?

I’m trying to filter blocks by their types using a method from the API reference example

syntaxTree(editorView.state).iterate({
  from: range.from,
  to: range.to,
  enter: (node) => {
    // some manipulations with this field
    // node.type.name
  },
}));

But in a big document I’m getting different results depending on a scroll position. So I can’t reliably identify block types with this recommended method.
Why results differ, and how to deal with it?

The short answer is yes; codemirror does that.
The codemirror docs (which you should consult whenever having trouble with codemirror) mentions the ensureSyntaxTree function:

https://codemirror.net/docs/ref/#language.ensureSyntaxTree

Usage example:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.