Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.
LOOM Unreleased (PR #2) / TEXT, MARKDOWN, AND EDITING
MarkdownPalette
Nested attributes combine; terminal-default colors inherit the surrounding color. preservesSoftBreaks defaults to false and is changed after initialization. codeBlockHeader enables full-row code panels. compactCodeBlocks applies when those headers are enabled. codeHighlighter is an application-supplied Sendable closure; syntax highlighting is not built in.
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
var palette = MarkdownPalette(heading: Style(foreground: .rgb(237, 166, 98), bold: true))
palette.preservesSoftBreaks = true
_ = MarkdownText.spans("# Hello", palette: palette)Members on this page
Feature guides and release status
MarkdownPalette
struct MarkdownPaletteConforms to: Swift.Sendable, Swift.SendableMetatype.
Styles used by the focused terminal Markdown renderer.
Nested markup combines enabled attributes. A terminal-default color inherits its surrounding color so emphasis can retain the body's palette.
Source · MarkdownText.swift:5preservesSoftBreaks
var preservesSoftBreaks: BoolPreserves source soft line breaks for applications with line-oriented transcripts.
Source · MarkdownText.swift:7body
var body: StyleDefault Markdown body style.
Source · MarkdownText.swift:8heading
var heading: StyleMarkdown heading style.
Source · MarkdownText.swift:9emphasis
var emphasis: StyleItalic/emphasis style.
Source · MarkdownText.swift:10strong
var strong: StyleStrong-emphasis style.
Source · MarkdownText.swift:11code
var code: StyleStyle for inline code and fenced-code content.
Source · MarkdownText.swift:12codeBlockHeader
var codeBlockHeader: Style?Enables full-row code panels and a header anchor when a style is supplied.
Source · MarkdownText.swift:14compactCodeBlocks
var compactCodeBlocks: BoolReserves three blank summary rows per code block when code headers are enabled.
Source · MarkdownText.swift:16codeBlockPrefix
var codeBlockPrefix: StringPrefix on each fenced-code line when code headers are disabled.
Source · MarkdownText.swift:18codeHighlighter
var codeHighlighter: (@Sendable (String, String?) -> [TextSpan])?Optional host-owned highlighting for displayed fenced code.
Source · MarkdownText.swift:20quote
var quote: StyleBlock-quote style.
Source · MarkdownText.swift:21link
var link: StyleStyle applied to Markdown link text; the destination is stored on TextSpan.link.
Source · MarkdownText.swift:22init(body:heading:emphasis:strong:code:quote:link:codeBlockHeader:compactCodeBlocks:codeBlockPrefix:codeHighlighter:)
init(body: Style = Style(), heading: Style = Style(bold: true), emphasis: Style = Style(italic: true), strong: Style = Style(bold: true), code: Style = Style(), quote: Style = Style(), link: Style = Style(underlined: true), codeBlockHeader: Style? = nil, compactCodeBlocks: Bool = false, codeBlockPrefix: String = "│ ", codeHighlighter: (@Sendable (String, String?) -> [TextSpan])? = nil)Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (11)
body- Argument type and any default are shown in the declaration; see the behavior notes above.
heading- Argument type and any default are shown in the declaration; see the behavior notes above.
emphasis- Argument type and any default are shown in the declaration; see the behavior notes above.
strong- 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.
quote- Argument type and any default are shown in the declaration; see the behavior notes above.
link- Argument type and any default are shown in the declaration; see the behavior notes above.
codeBlockHeader- Argument type and any default are shown in the declaration; see the behavior notes above.
compactCodeBlocks- Argument type and any default are shown in the declaration; see the behavior notes above.
codeBlockPrefix- Argument type and any default are shown in the declaration; see the behavior notes above.
codeHighlighter- Argument type and any default are shown in the declaration; see the behavior notes above.