diff --git a/README.md b/README.md index 91fd2dab..dad2814e 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# MarkdownUI +# Flexible MarkdownUI [![CI](https://github.com/gonzalezreal/MarkdownUI/workflows/CI/badge.svg)](https://github.com/gonzalezreal/MarkdownUI/actions?query=workflow%3ACI) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fgonzalezreal%2FMarkdownUI%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/gonzalezreal/MarkdownUI) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fgonzalezreal%2FMarkdownUI%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/gonzalezreal/MarkdownUI) [![contact: @gonzalezreal](https://img.shields.io/badge/contact-@gonzalezreal-blue.svg?style=flat)](https://twitter.com/gonzalezreal) -MarkdownUI is a Swift package for rendering Markdown in SwiftUI, fully compliant with the -[CommonMark Spec](https://spec.commonmark.org/current/). +Flexible MarkdownUI is a Swift package for rendering Markdown in SwiftUI, fully compliant with the +[CommonMark Spec](https://spec.commonmark.org/current/). Our fork supports flexible width, with flexibleWidth in configuration. ## Supported Platforms @@ -323,11 +323,11 @@ Markdown( You can add MarkdownUI to an Xcode project by adding it as a package dependency. 1. From the **File** menu, select **Add Packages…** -1. Enter `https://github.com/gonzalezreal/MarkdownUI` into the *Search or Enter Package URL* search +1. Enter `https://github.com/wilmaplus/MarkdownUI` into the *Search or Enter Package URL* search field 1. Link **MarkdownUI** to your application target ## Other Libraries * [CommonMarkAttributedString](https://github.com/mattt/CommonMarkAttributedString) * [Down](https://github.com/johnxnguyen/Down) -* [AttributedText](https://github.com/gonzalezreal/AttributedText) +* [FlexibleAttributedText](https://github.com/wilmaplus/FlexibleAttributedText) diff --git a/Sources/MarkdownUI/Markdown.swift b/Sources/MarkdownUI/Markdown.swift index fc5ac2c7..25724ef4 100644 --- a/Sources/MarkdownUI/Markdown.swift +++ b/Sources/MarkdownUI/Markdown.swift @@ -1,7 +1,7 @@ -import FlexibleAttributedText import Combine import CombineSchedulers @_exported import CommonMark +import FlexibleAttributedText import SwiftUI /// A view that displays Markdown-formatted text. @@ -227,10 +227,13 @@ public struct Markdown: View { } public var body: some View { - FlexibleAttributedText(self.viewState.attributedString, onOpenLink: openMarkdownLink?.handler, flexibleWidth: style.measurements.flexibleWidth) - .onReceive(self.viewStatePublisher) { viewState in - self.viewState = viewState - } + FlexibleAttributedText( + self.viewState.attributedString, onOpenLink: openMarkdownLink?.handler, + flexibleWidth: style.measurements.flexibleWidth + ) + .onReceive(self.viewStatePublisher) { viewState in + self.viewState = viewState + } } private func loadMarkdownImages(_ hashValue: Int) -> AnyPublisher { diff --git a/Sources/MarkdownUI/Style/Measurements.swift b/Sources/MarkdownUI/Style/Measurements.swift index 9654413c..183dfd6f 100644 --- a/Sources/MarkdownUI/Style/Measurements.swift +++ b/Sources/MarkdownUI/Style/Measurements.swift @@ -26,7 +26,7 @@ extension MarkdownStyle { /// The distance between the bottom of a heading and the top of the next block, relative to the base font size. public var headingSpacing: CGFloat - + public var flexibleWidth: Bool /// Creates a `Measurements` instance.