Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
Conflicts:
	Package.resolved
  • Loading branch information
developerfromjokela committed Jul 8, 2022
2 parents 10828ea + 4181398 commit 9b3aa0e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/[email protected]?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

Expand Down Expand Up @@ -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)
13 changes: 8 additions & 5 deletions Sources/MarkdownUI/Markdown.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import FlexibleAttributedText
import Combine
import CombineSchedulers
@_exported import CommonMark
import FlexibleAttributedText
import SwiftUI

/// A view that displays Markdown-formatted text.
Expand Down Expand Up @@ -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<ViewState, Never> {
Expand Down
2 changes: 1 addition & 1 deletion Sources/MarkdownUI/Style/Measurements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9b3aa0e

Please sign in to comment.