-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba3140b
commit 813ab52
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import MarkdownUI | ||
import SwiftUI | ||
|
||
struct DingusView: View { | ||
@State private var text = #""" | ||
## Try CommonMark | ||
You can try CommonMark here. This dingus is powered by | ||
[MarkdownUI](https://github.com/gonzalezreal/MarkdownUI), a | ||
CommonMark renderer for SwiftUI. | ||
1. item one | ||
1. item two | ||
- sublist | ||
- sublist | ||
"""# | ||
|
||
var body: some View { | ||
VStack { | ||
TextEditor(text: $text) | ||
.font(.system(.callout, design: .monospaced)) | ||
.lineLimit(20) | ||
.padding() | ||
.background(Color(.textBackgroundColor)) | ||
.border(Color.primary.opacity(0.25), width: 0.5) | ||
.padding([.top, .horizontal]) | ||
|
||
ScrollView { | ||
Markdown(Document(text)) | ||
.padding() | ||
} | ||
.border(Color.primary.opacity(0.25), width: 0.5) | ||
.padding([.bottom, .horizontal]) | ||
} | ||
} | ||
} |