Home

Code Block

Properties

The CodeBlock type has these properties:

NameDescriptionTypeInherited from
idThe identifier for this item.StringEntity
codeThe code.CordCodeStatic
programmingLanguageThe programming language of the code.StringCodeStatic
authorsThe authors of the code.Author*CodeStatic
provenanceA summary of the provenance of the code.ProvenanceCount*CodeStatic

Related

The CodeBlock type is related to these types:

Bindings

The CodeBlock type is represented in:

Testing

During property-based (a.k.a generative) testing, the properties of the CodeBlock type are generated using the following strategies.

PropertyComplexityDescriptionStrategy
codeMin+Generate a simple fixed string of code.Cord::from("code")
Low+Generate a random string of up to 10 alphanumeric characters (exclude whitespace whichcan be problematic in Markdown).r"[a-zA-Z0-9]{1,10}".prop_map(Cord::from)
High+Generate a random string of up to 100 characters (excluding control characters).r"[^\p{C}]{1,100}".prop_map(Cord::from)
MaxGenerate an arbitrary string.String::arbitrary().prop_map(Cord::from)
programmingLanguageMin+Do not generate a programming language.None
Low+Generate one of the well known programming language short names.option::of(r"(cpp)|(js)|(py)|(r)|(ts)")
High+Generate a random string of up to 10 alphanumeric characters.option::of(r"[a-zA-Z0-9]{1,10}")
MaxGenerate an arbitrary string.option::of(String::arbitrary())

This documentation was generated from CodeBlock.yaml by docs_types.rs.

© 2026 Stencila