Files
helder/Sources/HelderCore/Markdown/MarkdownModels.swift
T

34 lines
1.2 KiB
Swift

import Foundation
public enum TableAlignment: String, Sendable, Equatable {
case left, center, right
}
public enum ImageSource: Sendable, Equatable {
/// A project-relative file, read through FileServicing.
case local(path: String)
case remote(URL)
}
public indirect enum MarkdownInline: Sendable, Equatable {
case text(String)
case code(String)
case strong([MarkdownInline])
case emphasis([MarkdownInline])
case strikethrough([MarkdownInline])
case link(text: [MarkdownInline], url: String, title: String?)
case image(alt: String, source: ImageSource, title: String?)
}
public indirect enum MarkdownBlock: Sendable, Equatable {
case heading(level: Int, content: [MarkdownInline])
case paragraph([MarkdownInline])
/// A fenced block; `language` is nil when the info string is unknown.
case code(language: Language?, text: String)
case quote([MarkdownBlock])
case list(ordered: Bool, items: [[MarkdownInline]])
/// Header cells, per-column alignment, then body rows padded to the header width.
case table(header: [[MarkdownInline]], alignments: [TableAlignment?], rows: [[[MarkdownInline]]])
case rule
}