Add support for <details> and <summary> tags (#6077)

This commit is contained in:
Stefan Ceriu
2026-09-03 11:47:12 +03:00
committed by GitHub
parent 7052751e38
commit 4355307ba0
15 changed files with 134 additions and 22 deletions
@@ -8,11 +8,6 @@
import Foundation
enum BlockquoteAttribute: AttributedStringKey {
typealias Value = Bool
static let name = "MXBlockquoteAttribute"
}
enum UserIDAttribute: AttributedStringKey {
typealias Value = String
static let name = "MXUserIDAttribute"
@@ -65,6 +60,17 @@ enum AllUsersMentionAttribute: AttributedStringKey {
static let name = "MXAllUsersMentionAttribute"
}
enum BlockquoteAttribute: AttributedStringKey {
typealias Value = Bool
static let name = "MXBlockquoteAttribute"
}
/// Marks the content of a `<details>` element, carrying its `<summary>` as the value.
enum DetailsAttribute: AttributedStringKey {
typealias Value = String
static let name = "MXDetailsAttribute"
}
enum CodeBlockAttribute: AttributedStringKey {
typealias Value = Bool
static let name = "MXCodeBlockAttribute"
@@ -78,6 +84,7 @@ enum InlineCodeAttribute: AttributedStringKey {
nonisolated extension AttributeScopes {
struct ElementXAttributes: AttributeScope {
let blockquote: BlockquoteAttribute
let details: DetailsAttribute
let userID: UserIDAttribute
// periphery:ignore - required to make NSAttributedString to AttributedString conversion even if not used directly