loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / TEXT, MARKDOWN, AND EDITING

MarkdownText

Swift Markdown parses syntax; loom creates styled spans for common headings, lists, quotes, emphasis, links, and fenced code. Only HTTP(S) destinations become terminal links. Unclosed inline markup remains literal; an open code fence styles streamed content received so far. Tables, HTML, and unsupported constructs remain literal. Images are not downloaded or rendered as graphics.

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 spans = MarkdownText.spans("# Hello\n\nA **Swift** terminal.")
_ = Paragraph(TextLayout(spans, width: 60, wrapping: .word))
Members on this page

Feature guides and release status

MarkdownText

Enumeration
enum MarkdownText

Renders the common chat Markdown forms as styled terminal text.

Swift Markdown owns syntax parsing; loom supplies terminal styles and list, quote, and code prefixes. Only HTTP(S) destinations become terminal links. Unclosed inline markup stays literal, while an open code fence styles the content received so far. Call it again as a response streams.

Source · MarkdownText.swift:52

streaming(_:isComplete:palette:)

Type Method
static func streaming(_ text: String, isComplete: Bool = false, palette: MarkdownPalette = MarkdownPalette()) -> MarkdownStreamingSnapshot

Renders the complete source received so far, holding its last block mutable.

Pass isComplete: true once the response finishes to resolve references and release the final block. Swift Markdown determines block/container boundaries.

Parameters (3)
text
Source text.
isComplete
Argument type and any default are shown in the declaration; see the behavior notes above.
palette
Markdown style and code-presentation choices.

Returns MarkdownStreamingSnapshot.

Source · MarkdownStreamingSnapshot.swift:21

spans(_:palette:)

Type Method
static func spans(_ text: String, palette: MarkdownPalette = MarkdownPalette()) -> [TextSpan]

Parses the source and returns styled TextSpan values with the supplied palette. Re-run as streamed Markdown changes; render the spans using TextLayout and Paragraph.

Parameters (2)
text
Source text.
palette
Markdown style and code-presentation choices.

Returns [TextSpan].

Source · MarkdownText.swift:53