meta.anchors.content.literal_syntax

Boundary-looking text inside fenced or indented code blocks, inline code, or escaped text does not open or close an anchor. Raw HTML examples do not supply anchor definitions, section headings, or end markers. A standalone end comment acts as a boundary only outside these literal contexts and enclosing HTML blocks.

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

Implementation

Implemented crates/sage-meta/src/spec.rs:322–327

sage_meta::spec · lib:sage_meta

#![allow(unused)]
fn main() {
            // {anchor}`meta.anchors.content.literal_syntax`
            Event::Text(_) if !in_code_block && !in_html_block && html_tags.is_empty() => {
                let text = &source.source[range.clone()];
                for (relative, _) in text.match_indices("{anchor}") {
                    let start = range.start + relative;
                    if is_escaped(&source.source, start) {

}

See more source ↗

Tests and review

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

Implemented sage_meta::prose_rendering_hides_control_comments_but_preserves_literal_examples

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.content.explicit_end)]
#[sage::test(meta.anchors.content.literal_syntax)]
fn prose_rendering_hides_control_comments_but_preserves_literal_examples() {
    use sage_meta::spec::{SpecChapter, SpecIndex, SpecSource};
    let source = "{anchor}`demo.rule` A rule.\n\nMore of the rule.\n\n<!-- end anchor -->\n\nOutside commentary.\n\n```html\n<!-- end anchor -->\n```\n\nInline `<!-- end anchor -->`.\n\n<div>\n\n<!-- end anchor -->\n\n</div>\n";
    let mut spec = SpecIndex::from_sources(&[SpecSource {
        file: "design/demo.md".into(),
        source: source.into(),
    }]);
    assert!(spec.diagnostics.is_empty(), "{:?}", spec.diagnostics);
    spec.chapters.insert(
        "design/demo.md".into(),
        SpecChapter {
            file: "design/demo.md".into(),
            namespace: String::new(),
            url: "design/demo.html".into(),
            normative: true,
        },
    );
    let html =
        sage_meta::render_spec_markdown(&spec, "design/demo.md", source, "sage-explorer.html")
            .unwrap();
    assert!(html.contains("More of the rule."));
    assert!(html.contains("Outside commentary."));
    assert!(!html.contains("<!-- end anchor -->"));
    assert_eq!(html.matches("&lt;!-- end anchor --&gt;").count(), 3);
    assert!(html.contains("<code>&lt;!-- end anchor --&gt;</code>"));
    assert!(html.contains("<pre><code class=\"language-html\">&lt;!-- end anchor --&gt;"));
    assert!(html.contains("&lt;div&gt;"));
}
}

See more source ↗

Implemented sage_meta::boundary_examples_in_code_escapes_and_enclosing_html_are_literal

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.content.literal_syntax)]
fn boundary_examples_in_code_escapes_and_enclosing_html_are_literal() {
    let body = r#"Opening.

```markdown
{anchor}`example.fenced` Example.
# Heading
<!-- end anchor -->
```

    {anchor}`example.indented` Example.
    Heading
    -------
    <!-- end anchor -->

`` {anchor}`example.inline` <!-- end anchor --> # Heading ``

\{anchor}`example.escaped` Example.

\# Heading

\<!-- end anchor -->

<div><span title="a > b and </span>">

# HTML heading

{anchor}`example.html` Example.

<!-- end anchor -->

</span></div>

<div
    class="example">

HTML heading
============

{anchor}`example.multiline_html` Example.

<!-- end anchor -->

</div>

Inline <span>

# Inline HTML heading

{anchor}`example.inline_html` Example.

<!-- end anchor -->

</span>

<!-- <div> does not open an enclosing element. -->

The actual final qualification."#;
    let text = format!(
        "{{anchor}}`meta.rule` {body}\n\n<!-- end anchor -->\n\nOutside.\n\n{{anchor}}`meta.fresh` Fresh."
    );
    let index = SpecIndex::from_sources(&[source("literals.md", &text)]);
    assert!(index.diagnostics.is_empty(), "{:?}", index.diagnostics);
    assert_eq!(index.anchors.len(), 2);
    assert_eq!(index.anchors["meta.rule"].content, body);
    assert_eq!(index.anchors["meta.fresh"].content, "Fresh.");
    let examples = SpecIndex::from_sources(&[source("examples.md", body)]);
    assert!(
        examples.diagnostics.is_empty(),
        "{:?}",
        examples.diagnostics
    );
    assert!(examples.anchors.is_empty());
}
}

See more source ↗

Implemented sage_meta::malformed_looking_comments_are_content_and_do_not_end_claims

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.content.explicit_end)]
#[sage::test(meta.anchors.content.literal_syntax)]
fn malformed_looking_comments_are_content_and_do_not_end_claims() {
    let body = "Opening.\n\n<!--end anchor-->\n\n<!-- end anchor --> trailing text\n\n<!-- end anchor --> <!-- another comment -->\n\nBefore <!-- end anchor -->\n\n<!-- end anchor\n-->\n\n<!-- outer comment\n<!-- end anchor -->\n\nAfter all examples.";
    let text = format!("{{anchor}}`meta.rule` {body}\n\n<!-- end anchor -->\nOutside.");
    let index = SpecIndex::from_sources(&[source("comments.md", &text)]);
    assert!(index.diagnostics.is_empty(), "{:?}", index.diagnostics);
    assert_eq!(index.anchors["meta.rule"].content, body);
}
}

See more source ↗

Implemented sage_meta::raw_html_text_does_not_hide_boundaries_after_its_closing_element

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.content.literal_syntax)]
fn raw_html_text_does_not_hide_boundaries_after_its_closing_element() {
    for html in [
        "<script>const example = \"<\";</script>",
        "<script>const example = \"<!--\";</script>",
        "<style>.example::before { content: \"<\"; }</style>",
        "<textarea>some < text</textarea>",
        "<pre>some < text</pre>",
        "<div>some < text</div>",
    ] {
        let body = format!("Claim.\n\n{html}");
        let text = format!(
            "{{anchor}}`meta.before` {body}\n\n<!-- end anchor -->\n\n{{anchor}}`meta.after` Following."
        );
        let index = SpecIndex::from_sources(&[source("html.md", &text)]);
        assert!(
            index.diagnostics.is_empty(),
            "{html}: {:?}",
            index.diagnostics
        );
        assert_eq!(index.anchors["meta.before"].content, body);
        assert_eq!(index.anchors["meta.after"].content, "Following.");
    }
}
}

See more source ↗

Implemented sage_meta::rendering_removes_only_parsed_end_markers

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.content.explicit_end)]
#[sage::test(meta.anchors.content.literal_syntax)]
fn rendering_removes_only_parsed_end_markers() {
    let text = "{anchor}`claim` A claim.\n\n```html\n<!-- end anchor -->\n```\n\n<div>\n\n<!-- end anchor -->\n\n</div>\n\n<!--end anchor-->\n\n  <!-- end anchor --> \t\n\nOutside prose.\n";
    let fixture = BookFixture::new("- [Rules](design/rules.md)\n");
    fixture.write("design/rules.md", text);
    let index = fixture.load();
    assert!(index.diagnostics.is_empty(), "{:?}", index.diagnostics);
    for rendered in [
        render_anchors(text).unwrap(),
        index.render_chapter("design/rules.md", text).unwrap(),
    ] {
        assert!(!rendered.contains("  <!-- end anchor --> \t"));
        assert_eq!(rendered.matches("<!-- end anchor -->").count(), 2);
        assert!(rendered.contains("```html\n<!-- end anchor -->\n```"));
        assert!(rendered.contains("<div>\n\n<!-- end anchor -->\n\n</div>"));
        assert!(rendered.contains("<!--end anchor-->"));
        assert!(rendered.ends_with("Outside prose.\n"));
    }
    let replacements = index.role_replacements("design/rules.md", text).unwrap();
    let removals = replacements
        .iter()
        .filter(|(_, value)| value.is_empty())
        .collect::<Vec<_>>();
    assert_eq!(removals.len(), 1);
    let (span, _) = removals[0];
    assert_eq!(&text[span.start..span.end], "  <!-- end anchor --> \t");
}
}

See more source ↗

Review: Accepted · Codex /root/anchor_094.

Fresh final followup review of literal_syntax. Saved/read the prior complete report and inputs, started fresh, recaptured all three dependencies and compared every fragment. The sole difference is an unrelated implementation_references association comment in spec.rs. The claim, all five tests, source/BookFixture helpers and browser rendering dependency are unchanged. No literal-context or rendering behavior changed.

The full claim requires definition/heading/end-looking text to remain inert inside fenced/indented/inline code, escapes and raw/enclosing HTML, with standalone end comments active only outside those contexts. The ordinary parser association processes definition Text events only outside code/HTML states and enclosing tags; inline code is not Text, and odd preceding backslashes suppress escaped definitions. Heading closure requires an empty HTML stack. End-comment recognition requires a complete standalone HTML block outside enclosing tags. finish_anchor retains the original contiguous source, so treating examples literally preserves rather than deletes them. update_anchor_html_tags tracks enclosing elements across blank lines, handles quoted delimiters and multiline tags, skips comment/CDATA/processing-instruction bodies and invalid less-than text, and treats script/style/textarea/pre as raw text until their actual matching close. Stack updates resume real boundaries after closure. The new association comment does not affect this mechanism.

All five ordinary tests were read. boundary_examples_in_code_escapes_and_enclosing_html_are_literal asserts exact complete active content and exactly two real anchors for fenced/indented/inline/escaped examples, nested and multiline HTML, quoted false closing tags and inline-opened containers; parsing examples alone requires no definitions or diagnostics. malformed_looking_comments_are_content_and_do_not_end_claims preserves exact nonstandalone, nonexact, multiline and nested-looking comments until the real end. raw_html_text_does_not_hide_boundaries_after_its_closing_element covers script strings containing less-than/comment openers, style, textarea, pre and div text, requiring preserved body and recognition of the later genuine end/new definition. rendering_removes_only_parsed_end_markers checks direct and chapter rendering, exact removal span/count, preserved code/HTML/nonexact markers and outside prose. prose_rendering_hides_control_comments_but_preserves_literal_examples checks real control removal while retaining exactly three escaped literal examples, inline/fenced code markup and escaped HTML container.

Captured browser rendering uses shared role replacements and removes only recognized empty replacements before displaying remaining raw HTML literally, so it does not introduce an independent marker interpretation. The captured source and BookFixture helpers invoke production parsing/loading. No TODO/N/A entries or deferred clause exist. Every named context and resumption after actual HTML closure remain accounted for by current source and substantive assertions. This is a full claim assessment of the actual marker-only delta, with no other relied-on changes, rather than blind refresh. No source changes or test/build/browser execution occurred; fresh review commands and source inspection only. 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