Skip to main content

next_free_title

Function next_free_title 

Source
fn next_free_title(doc: &Document, prefix: &str) -> String
Expand description

The lowest {prefix}<n> from 1 up that no live block titles itself, so two blocks the user has not named are still told apart wherever their titles are listed — the nav breadcrumb, the hierarchy, the PDF outline.

The search reads the titles the document actually holds rather than counting blocks, so it stays deterministic and collision-free after a delete or a paste: a document that lost Block 2 mints that name again instead of climbing past it forever.