MarkdownText uses SwiftUI-style APIs to allow customization of markdown elements. You can implement custom styles by conforming to specific style protocols (e.g., UnorderedListBulletMarkdownStyle, ImageMarkdownStyle) and providing a makeBody(configuration:) method.
Customizing Bullets
struct CustomUnorderedBullets: UnorderedListBulletMarkdownStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.foregroundColor(.blue)
}
}
Customizing Image Animations
struct ScaledImageStyle: ImageMarkdownStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.transition(.scale)
}
}
struct CustomUnorderedBullets: UnorderedListBulletMarkdownStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.foregroundColor(.blue)
}
}
struct ScaledImageStyle: ImageMarkdownStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.transition(.scale)
}
}