loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / 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

Structure
struct MarkdownPalette

Conforms 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:5

preservesSoftBreaks

Instance Property
var preservesSoftBreaks: Bool

Preserves source soft line breaks for applications with line-oriented transcripts.

Source · MarkdownText.swift:7

body

Instance Property
var body: Style

Default Markdown body style.

Source · MarkdownText.swift:8

heading

Instance Property
var heading: Style

Markdown heading style.

Source · MarkdownText.swift:9

emphasis

Instance Property
var emphasis: Style

Italic/emphasis style.

Source · MarkdownText.swift:10

strong

Instance Property
var strong: Style

Strong-emphasis style.

Source · MarkdownText.swift:11

code

Instance Property
var code: Style

Style for inline code and fenced-code content.

Source · MarkdownText.swift:12

codeBlockHeader

Instance Property
var codeBlockHeader: Style?

Enables full-row code panels and a header anchor when a style is supplied.

Source · MarkdownText.swift:14

compactCodeBlocks

Instance Property
var compactCodeBlocks: Bool

Reserves three blank summary rows per code block when code headers are enabled.

Source · MarkdownText.swift:16

codeBlockPrefix

Instance Property
var codeBlockPrefix: String

Prefix on each fenced-code line when code headers are disabled.

Source · MarkdownText.swift:18

codeHighlighter

Instance Property
var codeHighlighter: (@Sendable (String, String?) -> [TextSpan])?

Optional host-owned highlighting for displayed fenced code.

Source · MarkdownText.swift:20

quote

Instance Property
var quote: Style

Block-quote style.

Source · MarkdownText.swift:21