Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/MarkdownUI/DSL/Inlines/Emphasis.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
/// An emphasized text in a Markdown content block.
public struct Emphasis: InlineContentProtocol {
public var _inlineContent: InlineContent {
.init(inlines: [.emphasis(children: self.content.inlines)])
.init(inlines: [.emphasis(self.content.inlines)])
}

private let content: InlineContent
Expand Down
2 changes: 1 addition & 1 deletion Sources/MarkdownUI/DSL/Inlines/InlineImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Foundation
/// ![](InlineImage)
public struct InlineImage: InlineContentProtocol {
public var _inlineContent: InlineContent {
.init(inlines: [.image(source: self.source, children: self.content.inlines)])
.init(inlines: [.image(source: self.source, self.content.inlines)])
}

private let source: String
Expand Down
2 changes: 1 addition & 1 deletion Sources/MarkdownUI/DSL/Inlines/InlineLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Foundation
/// ```
public struct InlineLink: InlineContentProtocol {
public var _inlineContent: InlineContent {
.init(inlines: [.link(destination: self.destination, children: self.content.inlines)])
.init(inlines: [.link(destination: self.destination, self.content.inlines)])
}

private let destination: String
Expand Down
2 changes: 1 addition & 1 deletion Sources/MarkdownUI/DSL/Inlines/Strikethrough.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
/// A deleted or redacted text in a Markdown content block.
public struct Strikethrough: InlineContentProtocol {
public var _inlineContent: InlineContent {
.init(inlines: [.strikethrough(children: self.content.inlines)])
.init(inlines: [.strikethrough(self.content.inlines)])
}

private let content: InlineContent
Expand Down
2 changes: 1 addition & 1 deletion Sources/MarkdownUI/DSL/Inlines/Strong.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
/// A strong text in a Markdown content block.
public struct Strong: InlineContentProtocol {
public var _inlineContent: InlineContent {
.init(inlines: [.strong(children: self.content.inlines)])
.init(inlines: [.strong(self.content.inlines)])
}

private let content: InlineContent
Expand Down
20 changes: 10 additions & 10 deletions Sources/MarkdownUI/Parser/InlineNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ enum InlineNode: Hashable {
case lineBreak
case code(String)
case html(String)
case emphasis(children: [InlineNode])
case strong(children: [InlineNode])
case strikethrough(children: [InlineNode])
case link(destination: String, children: [InlineNode])
case image(source: String, children: [InlineNode])
case emphasis([InlineNode])
case strong([InlineNode])
case strikethrough([InlineNode])
case link(destination: String, [InlineNode])
case image(source: String, [InlineNode])
}

extension InlineNode {
Expand All @@ -35,15 +35,15 @@ extension InlineNode {
set {
switch self {
case .emphasis:
self = .emphasis(children: newValue)
self = .emphasis(newValue)
case .strong:
self = .strong(children: newValue)
self = .strong(newValue)
case .strikethrough:
self = .strikethrough(children: newValue)
self = .strikethrough(newValue)
case .link(let destination, _):
self = .link(destination: destination, children: newValue)
self = .link(destination: destination, newValue)
case .image(let source, _):
self = .image(source: source, children: newValue)
self = .image(source: source, newValue)
default:
break
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/MarkdownUI/Parser/MarkdownParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,20 @@ extension InlineNode {
case .html:
self = .html(unsafeNode.literal ?? "")
case .emphasis:
self = .emphasis(children: unsafeNode.children.compactMap(InlineNode.init(unsafeNode:)))
self = .emphasis(unsafeNode.children.compactMap(InlineNode.init(unsafeNode:)))
case .strong:
self = .strong(children: unsafeNode.children.compactMap(InlineNode.init(unsafeNode:)))
self = .strong(unsafeNode.children.compactMap(InlineNode.init(unsafeNode:)))
case .strikethrough:
self = .strikethrough(children: unsafeNode.children.compactMap(InlineNode.init(unsafeNode:)))
self = .strikethrough(unsafeNode.children.compactMap(InlineNode.init(unsafeNode:)))
case .link:
self = .link(
destination: unsafeNode.url ?? "",
children: unsafeNode.children.compactMap(InlineNode.init(unsafeNode:))
unsafeNode.children.compactMap(InlineNode.init(unsafeNode:))
)
case .image:
self = .image(
source: unsafeNode.url ?? "",
children: unsafeNode.children.compactMap(InlineNode.init(unsafeNode:))
unsafeNode.children.compactMap(InlineNode.init(unsafeNode:))
)
default:
assertionFailure("Unhandled node type '\(unsafeNode.nodeType)' in InlineNode.")
Expand Down
4 changes: 2 additions & 2 deletions Sources/MarkdownUI/Views/Inlines/ImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ struct ImageView: View {
content: [
.link(
destination: destination,
children: [.image(source: self.data.source, children: [.text(self.data.alt)])]
[.image(source: self.data.source, [.text(self.data.alt)])]
)
]
)
} else {
return .paragraph(
content: [.image(source: self.data.source, children: [.text(self.data.alt)])]
content: [.image(source: self.data.source, [.text(self.data.alt)])]
)
}
}
Expand Down