import SwiftUI /// Syntax highlighting for `#+begin_src` blocks, supplied by the app. /// /// The native counterpart to ``CodeHighlighter``: that one returns HTML for the HTML /// renderer, this returns an `AttributedString`. Keeping it a protocol is what lets /// OrgSwiftUI stay dependency-free — a highlighting engine is the app's business. /// /// Returning nil means "show it as plain monospaced text", which is a fine outcome for an /// unknown language, never an error. @MainActor public protocol OrgCodeStyler { func highlighted(code: String, language: String?) -> AttributedString? } /// The default: no highlighting. public struct PlainOrgCodeStyler: OrgCodeStyler { nonisolated public init() {} public func highlighted(code _: String, language _: String?) -> AttributedString? { nil } }