Skip to main content

section_insert

Function section_insert 

Source
pub fn section_insert(
    content: &str,
    anchor: &SectionAddress,
    position: Option<&Value>,
    heading: Option<&str>,
    body: Option<&str>,
    children: Option<&Value>,
) -> Result<String>
Expand description

Insert a new section relative to an existing one.

The level is DERIVED, never passed. before/after make a sibling of the anchor; first-child/last-child make a child one level deeper. This is the list family’s L4 result carried across: the model cannot see the document, so a level argument is a number it would have to invent, and deriving it makes an impossible level unexpressible rather than merely invalid.

after means after the anchor’s whole subtree. Inserting ## [1.5.0] after ## [1.4.2] must land past that release’s ### Fixed and ### Changed, not between the heading and its first subsection — which is the single most common changelog edit there is.