jxxcarlson/scripta-compiler-v3/1.0.0

NOTE: the latest version is 1.0.1

Scripta.Document

Query functions over a parsed Scripta Document.

type alias Document =
Document

Re-export of the opaque Document type.

hasSections : Document -> Bool

Whether the document contains at least one section block. Used to decide whether the rendered output includes a table of contents.

idsContainingSource : String -> Document -> List String

Return the ids of all blocks whose source text contains target.

Replaces hand-rolled forest walks like Editor.matchingIdsInAST. Used for left-to-right sync: editor selection -> matching rendered element ids. An empty or whitespace-only target yields [].

sourceOfId : String -> Document -> Maybe String

Return the source text of the block with the given id, if any.

title : Document -> String

Return the document title (the text of its title block), or "" if there is no title block.