Published release 0.2.1. Unreleased PR #2 reference.
LOOM 0.2.1 / TEXT, MARKDOWN, AND EDITING
TextCodeBlock
Metadata retaining the original fenced code, its optional language, identity, and compact presentation flag. TextSpan and TextLayout.Line use it to preserve code-panel information. An id identifies a code block within the rendered content.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Example
let code = TextCodeBlock(id: 0, language: "swift", code: "print(1)")
let span = TextSpan("print(1)", codeBlock: code)
_ = TextLayout([span], width: 40)Members on this page
Feature guides and release status
TextCodeBlock
struct TextCodeBlockConforms to: Swift.Equatable, Swift.Sendable, Swift.SendableMetatype.
Original code associated with one Markdown block, independent of display wrapping.
Source · TextCodeBlock.swift:2id
let id: IntA source-byte identity that remains stable as text is appended to the Markdown source.
Source · TextCodeBlock.swift:4language
let language: String?Optional fenced-code language identifier.
Source · TextCodeBlock.swift:5code
let code: StringCode without fences or presentation prefixes, retaining source whitespace.
Source · TextCodeBlock.swift:7isCompact
let isCompact: BoolIndicates that the layout reserves a compact summary instead of displaying code.
Source · TextCodeBlock.swift:9init(id:language:code:isCompact:)
init(id: Int, language: String? = nil, code: String, isCompact: Bool = false)Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (4)
id- Stable entry/icon identity, not an array index.
language- Argument type and any default are shown in the declaration; see the behavior notes above.
code- Argument type and any default are shown in the declaration; see the behavior notes above.
isCompact- Argument type and any default are shown in the declaration; see the behavior notes above.