# swiftui-markdown **Repository Path**: CatREFuse/swiftui-markdown ## Basic Information - **Project Name**: swiftui-markdown - **Description**: SwiftUI Markdown 渲染组件 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-06-28 - **Last Updated**: 2022-06-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README SwiftUI Markdown === [![CI](https://github.com/jaywcjlove/markdown/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/markdown/actions/workflows/ci.yml) ![SwiftUI Support](https://shields.io/badge/SwiftUI-macOS%20v10.15%20%7C%20iOS%20v13-green?logo=Swift&style=flat) Render Markdown text in SwiftUI. It is a preview based on the [`Marked`](https://github.com/markedjs/marked) implementation. https://user-images.githubusercontent.com/1680273/159059803-d844769b-36ad-44c1-a296-a657de8d099c.mov ![Markdown Package Screenshot](https://user-images.githubusercontent.com/1680273/158006647-19d180e2-2549-4cd4-b108-91778beccc1b.png) ![Markdown Package Screenshot](https://user-images.githubusercontent.com/1680273/158075575-14c9c942-5b99-479c-9935-b631bac3828e.png) ![Markdown Package Screenshot](https://user-images.githubusercontent.com/1680273/158075581-925d267f-47ce-4468-b891-0fb2467b89df.png) ## Installation You can add MarkdownUI to an Xcode project by adding it as a package dependency. 1. From the File menu, select Add Packages… 2. Enter https://github.com/jaywcjlove/markdown the Search or Enter Package URL search field 3. Link `Markdown` to your application target Or add the following to `Package.swift`: ```swift .package(url: "https://github.com/jaywcjlove/markdown", from: "1.0.0") ``` Or [add the package in Xcode](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app). ## Usage ```swift import SwiftUI import Markdown struct ContentView: View { @State private var mdStr: String = """ ## Hello World Render Markdown text in SwiftUI. """ var body: some View { VStack { Markdown(content: $mdStr) TextEditor(text: $mdStr) } } } ``` ### `.markdownStyle()` Setting markdown related styles. ```swift Markdown(content: $mdStr) .markdownStyle( MarkdownStyle( padding: 0, paddingTop: 115, paddingBottom: 2, paddingLeft: 130, paddingRight: 5 ) ) ``` ```swift Markdown(content: $mdStr) .markdownStyle(MarkdownStyle(padding: 35 )) ``` ## Configure image ## License Licensed under the MIT License.