在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mattt/CommonMarkAttributedString开源软件地址(OpenSource Url):https://github.com/mattt/CommonMarkAttributedString开源编程语言(OpenSource Language):Swift 100.0%开源软件介绍(OpenSource Introduction):CommonMarkAttributedStringCommonMarkAttributedString is a Swift package that lets you create attributed strings using familiar CommonMark (Markdown) syntax. It's built on top of CommonMark, which is fully compliant with the CommonMark Spec. Supported Platforms
Usageimport CommonMarkAttributedString
let commonmark = "A *bold* way to add __emphasis__ to your `code`"
let attributes: [NSAttributedString.Key: Any] = [
.font: NSFont.systemFont(ofSize: 24.0),
.foregroundColor: NSColor.systemBlue,
]
let attributedString = try NSAttributedString(commonmark: commonmark, attributes: attributes) You can also use CommonMarkAttributedString to create attributed strings that have multiple paragraphs, with links, headings, lists, and images. let commonmark = #"""
# [Universal Declaration of Human Rights][uhdr]
## Article 1.
All human beings are born free and equal in dignity and rights.
They are endowed with reason and conscience
and should act towards one another in a spirit of brotherhood.
[uhdr]: https://www.un.org/en/universal-declaration-human-rights/ "View full version"
"""#
let attributes: [NSAttributedString.Key: Any] = [
.font: NSFont.systemFont(ofSize: NSFont.systemFontSize),
.foregroundColor: NSColor.textColor,
.backgroundColor: NSColor.textBackgroundColor,
]
let attributedString = try NSAttributedString(commonmark: commonmark, attributes: attributes) Supported CommonMark Elements
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论