import NorgKit import SwiftUI // General block renderer. struct BlockView: View { let block: NorgBlock let ordinal: Int? let onSetStatus: (Int, TaskStatus) -> Void var body: some View { switch block { case .heading(let level, let status, let content, let line): HeadingView( level: level, status: status, content: content, line: line, onSetStatus: onSetStatus) case .paragraph(let content, _): ParagraphView(content: content) case .unorderedListItem(_, let status, let content, let line): ListItemView( marker: "•", status: status, content: content, line: line, onSetStatus: onSetStatus) case .orderedListItem(_, let status, let content, let line): ListItemView( marker: "\(ordinal ?? 1).", status: status, content: content, line: line, onSetStatus: onSetStatus) case .quote(_, let status, let content, let line): QuoteView(status: status, content: content, line: line, onSetStatus: onSetStatus) case .codeBlock(let language, let code, _): CodeBlockView(language: language, code: code) case .definition(let title, let status, _, let line), .footnote(let title, let status, _, let line), .tableCell(let title, let status, _, let line): RangeableBlockView(title: title, status: status, line: line, onSetStatus: onSetStatus) case .rangedTag(let name, _, let content, _): RangedTagView(name: name, content: content) case .horizontalRule: Divider() case .weakDelimiter, .strongDelimiter: EmptyView() } } }