Update issue templates Add Feature Request template.
Update issue templates
Add Feature Request template.
Feature Request
MarkdownView is a Swift Package for rendering Markdown natively in SwiftUI.
Thanks to apple/swift-markdown, it can fully compliant with the CommonMark Spec.
Here is a preview :)
You can use MarkdownView in the following platforms:
You can create a Markdown view by providing a Markdown-formatted string.
Markdown
MarkdownView(text: "This is the Apple's **newly published** [swift-markdown](https://github.com/apple/swift-markdown)")
If your Markdown have check boxes, you can provide a Binding string.
Binding
@State var text = """ - [x] Write the press release - [ ] Update the website - [ ] Contact the media """
MarkdownView(text: $text)
For more information, Check out Documentation
You can set custom fonts or change text styles.
MarkdownView(text: "# H1 title") .font(.largeTitle.weight(.black), for: .h1)
Default tint color for code blocks and block quotes is the accent color.
You can customize them explicitly.
MarkdownView(text: "> Quote and `inline code`") .tint(.pink, for: .inlineCodeBlock)
You can add your custom image providers and block directive providers to display your content.
To do that, first create your provider.
struct CustomImageProvider: ImageDisplayable { func makeImage(url: URL, alt: String?) -> some View { AsyncImage(url: url) { switch $0 { case .empty: ProgressView() case .success(let image): image.resizable() case .failure(let error): Text(error.localizedDescription) @unknown default: Text("Unknown situation") } } } }
Then apply your provider to MarkdownView.
MarkdownView
MarkdownView(text: markdownText) .imageProvider(CustomImageProvider(), forURLScheme: "my-image")
The implementation of the block directive is exactly the same way.
.font(_:)
In your Package.swift Swift Package Manager manifest, add the following dependency to your dependencies argument:
Package.swift
dependencies
.package(url: "https://github.com/LiYanan2004/MarkdownView.git", .branch("main")),
Add the dependency to any targets you’ve declared in your manifest:
.target(name: "MyTarget", dependencies: ["MarkdownView"]),
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
MarkdownView
MarkdownView is a Swift Package for rendering Markdown natively in SwiftUI.
Thanks to apple/swift-markdown, it can fully compliant with the CommonMark Spec.
Here is a preview :)
Supported Platforms
You can use MarkdownView in the following platforms:
Highlighted Features
Getting started
You can create a
Markdown
view by providing a Markdown-formatted string.If your Markdown have check boxes, you can provide a
Binding
string.Further Customization
Font
You can set custom fonts or change text styles.
Tint
Default tint color for code blocks and block quotes is the accent color.
You can customize them explicitly.
Add Custom Providers
You can add your custom image providers and block directive providers to display your content.
To do that, first create your provider.
Then apply your provider to
MarkdownView
.The implementation of the block directive is exactly the same way.
Todos
.font(_:)
modifier.Swift Package Manager
In your
Package.swift
Swift Package Manager manifest, add the following dependency to yourdependencies
argument:Add the dependency to any targets you’ve declared in your manifest:
Dependencies