import OrgSwiftUI import SwiftUI /// Renders an issue/MR body or comment in whichever format it was stored as. /// Mirrors `ReadmeView`'s dispatch, keyed on the stored `body_format` rather /// than a file name. A missing format renders as markdown, matching every /// body written before org support existed. struct FormattedBodyView: View { let text: String var format: String? @Environment(\.colorScheme) private var colorScheme var isOrg: Bool { format == "org" } var body: some View { if isOrg { // Qualified: `OrgView` here is org-mode, not the organization view. OrgSwiftUI.OrgView( text, styler: OrgSyntaxStyler(colorScheme: colorScheme), keywords: OrgKeywordStyle(todo: .gbOK, done: .gbDone) ) } else { MarkdownView(markdown: text) } } }