import Foundation /// Produces highlighted HTML for a fenced code block. Returning `nil` makes the /// renderer fall back to an escaped `
` block.
public protocol CodeHighlighter {
    func highlightedHTML(code: String, language: String?) -> String?
}

/// A highlighter that performs no highlighting. The renderer escapes the code
/// and wraps it in `
` when this is used.
public struct PlainCodeHighlighter: CodeHighlighter {
    public init() {}
    public func highlightedHTML(code: String, language: String?) -> String? { nil }
}

/// Options controlling how relative links and images are resolved.
///
/// When `owner` and `repositoryName` are both non-nil, relative links and image
/// sources are rewritten to `{host}/{owner}/{repositoryName}/blob/{ref}/...`.
/// When either is nil, relative links are left as-is (and dropped by the
/// URL-scheme allowlist, which only permits absolute http/https/mailto).
public struct OrgRenderOptions {
    /// Host used to build absolute URLs for repository-relative links.
    public var host: String
    /// Repository owner (e.g. `~ccleberg`). Nil disables relative-link resolution.
    public var owner: String?
    /// Repository name. Nil disables relative-link resolution.
    public var repositoryName: String?
    /// Git ref used in the `/` path segment.
    public var ref: String
    /// Path of the README being rendered, used to resolve paths relative to it.
    public var readmePath: String?
    /// Path segment for a resolved relative *image* URL: `////…`.
    /// Defaults to `blob`; forges that serve raw bytes on a different route (gitbay uses
    /// `raw`) set this so an `` points at the file, not its HTML viewer page.
    public var imagePathSegment: String
    /// Path segment for a resolved relative *link* URL. Defaults to `blob` — a link should
    /// open the file's page, not its raw bytes.
    public var linkPathSegment: String
    /// Emit a leading `