You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MarkdownKit is a customizable and extensible Markdown parser for iOS and macOS. It supports many of the standard Markdown elements through the use of Regular Expressions. It also allows customization of font and color attributes for all the Markdown elements.
Screenshot
Installation
Installation via CocoaPods
MarkdownKit is available through CocoaPods. CocoaPods is a dependency manager that automates and simplifies the process of using 3rd-party libraries like MarkdownKit in your projects. You can install CocoaPods with the following command:
geminstallcocoapods
To integrate MarkdownKit into your Xcode project using CocoaPods, simply add the following line to your Podfile:
pod"MarkdownKit"
Afterwards, run the following command:
podinstall
Installation via Carthage
MarkdownKit is available through Carthage. Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage via Homebrew with the following command:
brewupdatebrewinstallcarthage
To integrate MarkdownKit into your Xcode project using Carthage, simply add the following line to your Cartfile:
*italic* or _italics_
**bold** or __bold__
~~strikethrough~~
# Header 1
## Header 2
### Header 3
#### Header 4
##### Header 5
###### Header 6
> Quote
* List
- List
+ List
`code` or ```code```
[Links](https://github.com/ivanbruel/MarkdownKit/)
Usage
In order to use MarkdownKit to transform Markdown into NSAttributedString, all you have to do is create an instance of MarkdownParser and call the parse(_) function.
letmarkdownParser=MarkdownParser()letmarkdown="I support a *lot* of custom Markdown **Elements**, even `code`!"
label.attributedText = markdownParser.parse(markdown)
letmarkdownParser=MarkdownParser(customElements:[MarkdownSubreddit()])letmarkdown="**/r/iosprogramming** can be *markdown* as well!"
label.attributedText = markdownParser.parse(markdown)
Example
To run the example project, clone the repo, and run pod install from the Example directory first.