krz/org-swift

A dependency-free Swift library that renders org-mode to sanitized HTML. html library org-mode swift

Commit 9cd7a260bd

9cd7a260bdd158939c5d11f7d99a63f337915fb3

parent: a9bc9a9685

Unsigned

cmc <hello@cleberg.net> · 2026-08-31 17:30 UTC

Drop Sendable from OrgHTMLTreeRenderer

It stores a CodeHighlighter, which a real implementation backs with a
thread-confined engine, so the conformance claimed a safety the type does
not have. Nothing held one across an isolation boundary. Warning-free
under strict concurrency now.

Layout: unified · split

Sources/OrgSwift/AST/OrgHTMLTreeRenderer.swift +5 −1
@@ -5,7 +5,11 @@ import Foundation
5/// The point of the prototype: this produces the same shape of output as the shipped 5/// The point of the prototype: this produces the same shape of output as the shipped
6/// single-pass ``OrgRenderer``, but from a parsed tree rather than from source, so a second 6/// single-pass ``OrgRenderer``, but from a parsed tree rather than from source, so a second
7/// renderer (see ``OrgAttributedStringRenderer``) can share the parse instead of re-deriving it. 7/// renderer (see ``OrgAttributedStringRenderer``) can share the parse instead of re-deriving it.
8public struct OrgHTMLTreeRenderer: Sendable { 8///
9/// Not `Sendable`: it holds a ``CodeHighlighter``, and a real one wraps a thread-confined
10/// engine (Highlightr's JavaScriptCore context, say). Sending the renderer across isolation
11/// domains would call that engine off its thread. Make one where you render.
12public struct OrgHTMLTreeRenderer {
9 /// The same options the shipped ``OrgRenderer`` takes, so this renderer is a drop-in for it. 13 /// The same options the shipped ``OrgRenderer`` takes, so this renderer is a drop-in for it.
10 public var options: OrgRenderOptions 14 public var options: OrgRenderOptions
11 public var highlighter: CodeHighlighter 15 public var highlighter: CodeHighlighter