meta.anchors.content.heading

A Markdown section heading ends the active anchor’s content immediately before the heading, regardless of heading level. Both hash-prefixed and underline-style headings are boundaries. Prose following the heading remains outside an anchor until another definition begins.

Read in specification context · design/meta/anchors.md

Implementation

Implemented crates/sage-meta/src/spec.rs:295–300

sage_meta::spec · lib:sage_meta

#![allow(unused)]
fn main() {
            // {anchor}`meta.anchors.content.heading`
            Event::Start(Tag::Heading { .. }) if html_tags.is_empty() => {
                finish_anchor(&source.source, range.start, &mut active, &mut anchors);
            }
            Event::Start(Tag::HtmlBlock) => {
                in_html_block = true;

}

See more source ↗

Tests and review

Indexed tests and the implementation-completeness and test-adequacy review; no test run is implied.

Implemented sage_meta::every_atx_and_setext_heading_closes_content_until_a_new_definition

crates/sage-meta/tests/spec.rs · test:spec

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.content.heading)]
#[sage::test(meta.anchors.content.explicit_end)]
fn every_atx_and_setext_heading_closes_content_until_a_new_definition() {
    // The explicit_end rule also says its marker is optional at another boundary.
    // Every input omits that marker: the heading alone must close the claim
    // without a missing-end error or capturing the following prose.
    for heading in [
        "# Heading",
        "## Heading",
        "### Heading",
        "#### Heading",
        "##### Heading",
        "###### Heading",
        "Heading\n=======",
        "Heading\n-------",
    ] {
        let text = format!(
            "{{anchor}}`meta.before` Opening.\n\nA qualification.\n\n{heading}\n\nOutside prose.\n\n{{anchor}}`meta.after` Fresh claim."
        );
        let index = SpecIndex::from_sources(&[source("headings.md", &text)]);
        assert!(
            index.diagnostics.is_empty(),
            "{heading}: {:?}",
            index.diagnostics
        );
        assert_eq!(
            index.anchors["meta.before"].content,
            "Opening.\n\nA qualification."
        );
        assert_eq!(index.anchors["meta.after"].content, "Fresh claim.");
        assert!(index.anchors["meta.before"].content_span.end < text.find(heading).unwrap());
    }
}
}

See more source ↗

Review: Accepted · Codex /root/anchor_094.

Fresh final followup of heading. Saved/read the previous complete report and inputs, started fresh and compared all fragments, including recaptured source helper. Claim, complete test and helper are unchanged. The only spec.rs delta is an implementation_references association comment on another method. No heading or closure behavior changed.

The full claim requires heading boundaries at every level in both hash/ATX and underline/Setext forms, with post-heading prose outside an anchor until a new definition. The sole ordinary implementation matches Markdown Tag::Heading without restricting level/form and passes its source start to finish_anchor. That helper slices content up to the heading, trims external whitespace and takes the active anchor, leaving none. Only a subsequent validated definition creates another active anchor. The HTML guard excludes literal heading-looking content. All of this remains in the captured whole file and is unaffected by the added comment.

The sole ordinary test every_atx_and_setext_heading_closes_content_until_a_new_definition directly iterates six ATX levels plus the two Setext forms. Each case has a multi-paragraph initial rule, heading, outside prose and fresh definition. Assertions require no diagnostics, exact first content excluding heading/outside prose, exact fresh content excluding the intervening prose, and the first source extent before the heading. The strict-before assertion reflects trimmed blank-line whitespace. These assertions cover every stated form/level and the reset/restart semantics without explicit end markers. The source helper wraps the supplied filename/text and invokes no substitute parsing. No TODO/N/A entries or deferrals exist.

The actual marker-only delta was assessed against the complete prior reasoning and current claim/test evidence, with no other changes in relied-on inputs. This review used start/read/record and source inspection only; no source edits or behavior test reruns. No requested edits.

Browse meta anchors

116 anchors

Specification anchors and declared coverage
AnchorImplementationTests
meta (116)102 Implemented24 TODO103 Implemented36 TODO
meta.anchors (22)22 Implemented21 Implemented12 TODO
anchor_pagesImplementedImplementedTODO
book_explorerImplementedImplementedTODO
canonical_sourcesImplementedImplementedTODO
meta.anchors.content (7)7 Implemented7 Implemented
blocksImplementedImplemented
explicit_endImplementedImplemented
headingImplementedImplemented
literal_syntaxImplementedImplemented
next_anchorImplementedImplemented
source_endImplementedImplemented
unmatched_endImplementedImplemented
context_navigationImplementedImplementedTODO
evidence_statusImplementedImplementedTODO
explorer_navigationImplementedTODO
implementation_coverageImplementedImplementedTODO
implementation_referencesImplementedImplementedTODO
placeholder_statusImplementedImplementedTODO
point_excerptsImplementedImplementedTODO
region_balanceImplementedImplemented
region_excerptsImplementedImplementedTODO
test_coverageImplementedImplemented
test_referencesImplementedImplemented
unique_namesImplementedImplementedTODO
meta.book (21)10 Implemented18 TODO12 Implemented18 TODO
anchor_movesImplementedTODOImplementedTODO
authorityImplementedTODOImplementedTODO
browser_deliveryTODOImplementedTODO
browser_dependenciesTODOTODO
browser_rust_sourceTODOTODO
browser_searchTODOTODO
browser_serveTODOTODO
browser_structureTODOTODO
chapter_namesImplementedTODOImplementedTODO
crate_ownershipImplementedImplemented
crates_landingImplementedImplemented
entity_linksTODOTODO
index_groupsImplementedTODOImplementedTODO
index_namespace_pagesImplementedImplemented
index_rowsImplementedTODOImplementedTODO
index_statusImplementedTODOImplementedTODO
rfd_changesTODOTODO
sage_chaptersTODOImplementedTODO
self_descriptionTODOTODO
shared_modelImplementedTODOImplementedTODO
source_rolesTODOTODO
meta.contracts (4)4 Implemented3 TODO4 Implemented3 TODO
cache_invocationsImplementedTODOImplementedTODO
correspondenceImplementedImplemented
observation_coverageImplementedTODOImplementedTODO
validated_sessionImplementedTODOImplementedTODO
meta.language (39)39 Implemented39 Implemented
meta.language.calls (2)2 Implemented2 Implemented
declaredImplementedImplemented
forbiddenImplementedImplemented
meta.language.classes (3)3 Implemented3 Implemented
abstract_completeImplementedImplemented
override_signatureImplementedImplemented
single_inheritanceImplementedImplemented
meta.language.contexts (1)1 Implemented1 Implemented
inheritanceImplementedImplemented
meta.language.envelopes (7)7 Implemented7 Implemented
class_callsImplementedImplemented
createsImplementedImplemented
direct_callsImplementedImplemented
leafImplementedImplemented
permissionsImplementedImplemented
readsImplementedImplemented
receiver_callsImplementedImplemented
meta.language.fields (2)2 Implemented2 Implemented
context_stateImplementedImplemented
kindsImplementedImplemented
meta.language.methods (2)2 Implemented2 Implemented
kindsImplementedImplemented
proseImplementedImplemented
meta.language.model (3)3 Implemented3 Implemented
forbidden_pathsImplementedImplemented
inherited_prohibitionsImplementedImplemented
virtual_dispatchImplementedImplemented
meta.language.types (19)19 Implemented19 Implemented
argument_arityImplementedImplemented
declaration_proseImplementedImplemented
enum_variantsImplementedImplemented
field_proseImplementedImplemented
generic_parametersImplementedImplemented
member_commasImplementedImplemented
name_resolutionImplementedImplemented
opaque_representationImplementedImplemented
preludeImplementedImplemented
qualified_namesImplementedImplemented
recursive_valuesImplementedImplemented
struct_fieldsImplementedImplemented
tuplesImplementedImplemented
type_expressionsImplementedImplemented
unique_fieldsImplementedImplemented
unique_parametersImplementedImplemented
unique_variantsImplementedImplemented
unknown_namesImplementedImplemented
variant_proseImplementedImplemented
meta.reviews (27)27 Implemented27 Implemented
claim_textImplementedImplemented
complete_test_setImplementedImplemented
decisionsImplementedImplemented
fragment_associationsImplementedImplemented
fragment_formatImplementedImplemented
fragment_freshnessImplementedImplemented
gateImplementedImplemented
input_formatImplementedImplemented
input_fragmentsImplementedImplemented
output_formatImplementedImplemented
preparationImplementedImplemented
record_requiredImplementedImplemented
recorded_readsImplementedImplemented
recordingImplementedImplemented
review_delegationImplementedImplemented
review_diagnosticsImplementedImplemented
review_instructionsImplementedImplemented
review_scopeImplementedImplemented
selector_claimImplementedImplemented
selector_line_rangeImplementedImplemented
selector_testImplementedImplemented
selector_whole_fileImplementedImplemented
source_representationImplementedImplemented
stalenessImplementedImplemented
summary_formatImplementedImplemented
test_sourceImplementedImplemented
validation_layoutImplementedImplemented
meta.validation (3)3 TODO3 TODO
claim_specific_evidenceTODOTODO
independent_inspectionTODOTODO
review_packetsTODOTODO