Skip to main content

process_spec_directives

Function process_spec_directives 

Source
pub(crate) fn process_spec_directives(
    content: &str,
    source_path: Option<&Path>,
    nt_map: &HashMap<String, String>,
) -> String
Expand description

Processes MyST {spec} directives into HTML with anchors and styling.

💡 Spec paragraph IDs are resolved from context:

  • File path prefix derived from source_path (e.g., syntax/string-literals.md → syntax.string-literals)
  • Current heading stack (e.g., ## Delimiters → delimiters)
  • Local name from the directive (e.g., :::{spec} quoted → quoted)

The directive :::{spec} quoted rfc0001 unimpl under ## Delimiters in syntax/string-literals.md resolves to syntax.string-literals.delimiters.quoted.

Inline sub-paragraphs {spec}`name` within a directive block create individually linkable sub-paragraph anchors.