Bot releases are visible (Hide)
FontWidth
, a text style that adjusts the font width (thanks @kirkbig #266)#if canImport(...)
instead of #if os(...)
(thanks @MojtabaHs #268)assertSnapshot(of:...)
instead of the deprecated assertSnapshot(matching:...)
(thanks @kirkbig #284)Full Changelog: https://github.com/gonzalezreal/swift-markdown-ui/compare/2.2.0...2.3.0
Published by gonzalezreal about 1 year ago
MarkdownContent
HTML rendering (thanks @srna, #253)Full Changelog: https://github.com/gonzalezreal/swift-markdown-ui/compare/2.1.0...2.2.0
Published by gonzalezreal over 1 year ago
codeBlock
style (#215)<br>
(#221)fixedSize
modifier from the paragraph view to the block style in all the bundled themes (#222)Full Changelog: https://github.com/gonzalezreal/swift-markdown-ui/compare/2.0.2...2.1.0
Published by gonzalezreal over 1 year ago
Markdown
view @State
property by @gonzalezreal in https://github.com/gonzalezreal/swift-markdown-ui/pull/197
ImageRenderer
demo by @gonzalezreal in https://github.com/gonzalezreal/swift-markdown-ui/pull/198
Full Changelog: https://github.com/gonzalezreal/swift-markdown-ui/compare/2.0.1...2.0.2
Published by gonzalezreal over 1 year ago
Full Changelog: https://github.com/gonzalezreal/swift-markdown-ui/compare/2.0.0...2.0.1
Published by gonzalezreal over 1 year ago
MarkdownUI 2 has been rewritten from scratch and brings a ton of new features and improvements
like:
These new features come with the cost of a few breaking changes that these notes will help you to
address.
You can use MarkdownUI 2 on the following platforms:
Some features, like displaying tables or multi-image paragraphs, require macOS 13.0+, iOS 16.0+,
tvOS 16.0+, and watchOS 9.0+.
To reflect the Swift community naming conventions, the package has been renamed from MarkdownUI
to swift-markdown-ui
. So, you may eventually need to update any Xcode projects or Package.swift
files that depend on MarkdownUI.
MarkdownUI 2 uses SwiftUI primitives to render Markdown and no longer depends on gonzalezreal/AttributedText.
MarkdownUI 2 introduces a new domain-specific language to create Markdown content and no longer
depends on gonzalezreal/SwiftCommonMark.
One significant difference when using MarkdownUI 2 is that MarkdownContent
replaces Document
by providing similar functionality.
Another thing to be aware of is the different naming of some of the types you use to compose
Markdown content:
Blockquote
instead of BlockQuote
.NumberedList
instead of OrderedList
.BulletedList
instead of BulletList
.InlineImage
instead of Image
.InlineLink
instead of Link
.Code
instead of InlineCode
.MarkdownUI 2 introduces the ImageProvider
protocol and its conforming types
DefaultImageProvider
and AssetImageProvider
. These types and the new
markdownImageProvider(_:)
modifier replace the MarkdownImageHandler
type and
the setImageHandler(_:forURLScheme:)
modifier.
The following example shows how to configure the asset image provider to load images from the
main bundle.
Markdown {
"![A dog](dog)"
"― Photo by André Spieker"
}
.markdownImageProvider(.asset)
The onOpenMarkdownLink(perform:)
modifier in MarkdownUI 1.x was provided to enable link behavior
customization in macOS 11.0, iOS 14.0, and tvOS 14.0. This modifier is no longer available in
MarkdownUI 2 since it does not support those platforms. However, you can customize the link
behavior by setting the openURL
environment value with a custom OpenURLAction
.
MarkdownUI 1.x offered a few options to customize the content appearance. In contrast, MarkdownUI 2
brings the new Theme
, TextStyle
, and BlockStyle
types that let you apply a custom
appearance to blocks and text inlines in a Markdown view.
Consequently, the MarkdownStyle
type, all of its subtypes, and the markdownStyle(_:)
modifier
are no longer available in MarkdownUI 2.
Published by gonzalezreal about 2 years ago
Full Changelog: https://github.com/gonzalezreal/MarkdownUI/compare/1.1.0...1.1.1
Published by gonzalezreal over 2 years ago
Full Changelog: https://github.com/gonzalezreal/MarkdownUI/compare/1.0.0...1.1.0
Published by gonzalezreal almost 3 years ago
NSAttributedString
based HTML block renderingPublished by gonzalezreal about 3 years ago
Published by gonzalezreal over 3 years ago
Published by gonzalezreal over 3 years ago
MarkdownStyle
is now a protocol with a default implementation DefaultMarkdownStyle
. This new protocol has methods to customise the attributes of each of the different blocks and inlines in a markdown file.
To customise the font, foreground color, code font or heading font sizes you can use the markdownStyle(_:)
view modifier:
Markdown(
#"""
## Inline code
If you have inline code blocks, wrap them in backticks: `var example = true`.
"""#
)
.markdownStyle(
DefaultMarkdownStyle(
font: .system(.body, design: .serif),
codeFontName: "Menlo",
codeFontSizeMultiple: 0.88
)
)
Published by gonzalezreal over 3 years ago
CommonMark parsing moved to gonzalezreal/SwiftCommonMark
SwiftCommonMark adds an embedded DSL to create CommonMark documents. This allows a new syntax when constructing Markdown
views:
Markdown {
Heading(level: 2) {
"Result builders are cool!"
}
"Sometimes you want bullet points:"
List {
"Start a line with a star"
"Profit!"
}
"Sometimes you want numbered lists:"
List(start: 1) {
"One"
"Two"
"Three"
}
}
Published by gonzalezreal over 3 years ago
Published by gonzalezreal almost 4 years ago
Published by gonzalezreal almost 4 years ago
Published by gonzalezreal almost 4 years ago
Published by gonzalezreal almost 4 years ago
Markdown
viewmarkdownBaseURL
view modifier.Document
with the content of the file at a given path.Published by gonzalezreal almost 4 years ago
Published by gonzalezreal almost 4 years ago