Marky Mark alternatives and similar libraries
Based on the "Text" category.
Alternatively, view Marky Mark alternatives based on common mentions on social networks and blogs.
-
YYText
Powerful text framework for iOS to display and edit rich text. -
Nimbus
The iOS framework that grows only as fast as its documentation -
PhoneNumberKit
A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber. -
ZSSRichTextEditor
A beautiful rich text WYSIWYG editor for iOS with a syntax highlighted source view -
Twitter Text Obj
Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform. -
FontAwesomeKit
Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons. -
SwiftRichString
👩🎨 Elegant Attributed String composition in Swift sauce -
libPhoneNumber-iOS
iOS port from libphonenumber (Google's phone number handling library) -
TwitterTextEditor
A standalone, flexible API that provides a full-featured rich text editor for iOS applications. -
RichEditorView
RichEditorView is a simple, modular, drop-in UIView subclass for Rich Text Editing. -
Down
Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark. -
SwiftyMarkdown
Converts Markdown files and strings into NSAttributedStrings with lots of customisation options. -
SwiftString
A comprehensive, lightweight string extension for Swift -
Iconic
:art: Auto-generated icon font library for iOS, watchOS and tvOS -
MMMarkdown
An Objective-C framework for converting Markdown to HTML. -
Atributika
Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement. -
CocoaMarkdown
Markdown parsing and rendering for iOS and OS X -
SwiftIconFont
Icons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon) -
FontBlaster
Programmatically load custom fonts into your iOS, macOS and tvOS app. -
Notepad
[iOS] A fully themeable markdown editor with live syntax highlighting. -
fuse-swift
A lightweight fuzzy-search library, with zero dependencies -
MarkdownKit
A simple and customizable Markdown Parser for Swift -
FormatterKit
stringWithFormat: for the sophisticated hacker set -
NSStringEmojize
A category on NSString to convert Emoji Cheat Sheet codes to their equivalent Unicode characters -
Mustard
🌭 Mustard is a Swift library for tokenizing strings when splitting by whitespace doesn't cut it. -
Guitar
A Cross-Platform String and Regular Expression Library written in Swift. -
Translucid
Lightweight library to set an Image as text background. Written in swift. -
Heimdall
Heimdall is a wrapper around the Security framework for simple encryption/decryption operations. -
GoogleMaterialDesignIcons
Google Material Design Icons Font for iOS -
AttributedTextView
Easiest way to create an attributed UITextView (with support for multiple links and from html)
Appwrite - The open-source backend cloud platform
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Marky Mark or a related project?
README
Marky Mark
Marky Mark is a parser written in Swift that converts markdown into native views. The way it looks it highly customizable and the supported markdown syntax is easy to extend.
[[Screenshot](Readme_Assets/example1-thumb.png)](Readme_Assets/example1.png) [[Screenshot](Readme_Assets/example2-thumb.png)](Readme_Assets/example2.png) [[Screenshot](Readme_Assets/example3-thumb.png)](Readme_Assets/example3.png)
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
- iOS 8.0+
- Xcode 8.0+
Installation
CocoaPods 1.0.0+ is required to build MarkyMark
To integrate MarkyMark into your Xcode project using CocoaPods, specify it in your Podfile
:
pod "markymark"
Alternatively, add MarkyMark to your project using Swift Package Manager using:
https://github.com/M2Mobi/Marky-Mark
Simple usage
View with default styling
let markDownView = MarkDownTextView()
markDownView.text = "# Header\nParagraph"
View with modified styling
Markymark has many styling options, please check the examples in the styling section of this readme. A simple example:
let markDownView = MarkDownTextView()
markDownView.styling.headingStyling.textColorsForLevels = [
.orange, //H1 (i.e. # Title)
.black, //H2, ... (i.e. ## Subtitle, ### Sub subtitle)
]
markDownView.styling.linkStyling.textColor = .blue
markDownView.styling.paragraphStyling.baseFont = .systemFont(ofSize: 14)
markDownView.text = "# Header\nParagraph"
Supported tags in the Default Flavor
Note: Different tags can be supported by either extending the ContentfulFlavor (default) or by implementing a class that comforms to Flavor
and implement the required Rule
's
Headings
# H1
## H2
### H3
#### H4
##### H5
###### H6
Lists
- item
- item
* item
* item
+ item
+ item
a. item
b. item
1. item
2. item
Emphasis
*Em*
_Em_
**Strong**
__Strong__
~~Strike through~~
Images

Links
[Link text](https://www.example.net)
Code
`code`
\```code```
Customizing default style
Default Styling instance
var styling = DefaultStyling()
Paragraphs (regular text)
Markdown example: Some text
styling.paragraphStyling.baseFont = .systemFont(ofSize: 14)
styling.paragraphStyling.textColor = .black
styling.paragraphStyling.contentInsets = UIEdgeInsets(top:0, left: 0, bottom: 5, right: 0)
styling.paragraphStyling.lineHeight = 4
styling.paragraphStyling.isBold = false
styling.paragraphStyling.isItalic = false
styling.paragraphStyling.textAlignment = .left
Headings
Markdown example: # Title
or ## Subtitle
etc.
styling.headingStyling.fontsForLevels = [
UIFont.boldSystemFontOfSize(24), //H1
UIFont.systemFontOfSize(18), //H2
UIFont.systemFontOfSize(16) //H3, ... (last item will be next levels as well)
]
styling.headingStyling.colorsForLevels = [
.red, //H1
.black, //H2, ... (last item will be next levels as well)
]
// Margins
styling.headingStyling.contentInsetsForLevels = [
UIEdgeInsets(top: 5, left: 0, bottom: 15, right: 10), // H1
UIEdgeInsets(top: 5, left: 0, bottom: 5, right: 10) //H2, ... (last item will be next levels as well)
]
styling.headingStyling.isBold = false
styling.headingStyling.isItalic = false
styling.headingStyling.isUnderlined = false
styling.headingStyling.textAlignment = .left
linkStyling
Markdown Example [Google](http://www.google.com)
styling.linkStyling.textColor = .black
styling.linkStyling.baseFont = nil // Default: nil. Setting baseFont to nil will inherit font from paragraphStyling
styling.linkStyling.isBold = false
styling.linkStyling.isItalic = false
styling.linkStyling.isUnderlined = true
List styling
Markdown Example:
- List item 1
- List item 2
- Nested List item
// By default a font will be used with the bullet character `•`. Use the follow properties to configure it's size and color:
styling.listStyling.bulletFont = .systemFont(ofSize: 14)
styling.listStyling.bulletColor = .black
// Bullets can also be images for more complex styling. When setting images, bullet font and color won't be used anymore
// Array of images used as bullet for each level of nested list items
styling.listStyling.bulletImages = [
UIImage(named: "circle"),
UIImage(named: "emptyCircle"),
UIImage(named: "line"),
UIImage(named: "square")
]
// Size of the images
styling.listStyling.bulletViewSize = CGSize(width: 16, height: 16)
styling.listStyling.baseFont = .systemFont(ofSize: 14)
styling.listStyling.contentInsets = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 10)
//Amount of space underneath each list item
styling.listStyling.bottomListItemSpacing = 5
// Number of pixels to indent for each nested list level
styling.listStyling.listIdentSpace = 15
styling.listStyling.textColor = .black
Styling is also possible for:
styling.paragraphStyling
styling.italicStyling
styling.boldStyling
styling.strikeThroughStyling
styling.imageStyling
styling.linkStyling
styling.horizontalLineStyling
styling.codeBlockStyling
styling.inlineCodeBlockStyling
styling.quoteStyling
Please check the DefaultStyling
class for more information
Advanced usage
Advanced usage is only needed for very specific cases. Making subsets of styling, making different styling combinations, supporting different Markdown rules (syntax) or modifying certain views after that have been generated.
Custom styling objects
struct CustomMarkyMarkStyling: Styling {
var headerStyling = CustomHeaderStyling()
var paragraphStyling = ParagraphStyling()
var linkStyling = ListStyling()
var itemStylingRules: [ItemStyling] {
return [headerStyling, paragraphStyling, linkStyling]
}
}
You can implement CustomHeaderStyling
by checking how other Styling
objects have been implemented, like `HeaderStyling
.
Make sure your CustomHeaderStyling
comforms to all styling rules you'd like your custom styling to support. i.e. comform to TextColorStylingRule
to support textStyle of your custom styling.
Each styling rule can be applied to a markDownItem by comforming to ItemStyling
and implement the required method like this:
public func isApplicableOn(_ markDownItem: MarkDownItem) -> Bool {
return markDownItem is HeaderMarkDownItem
}
This will let the mechanism know it should apply your styling to a HeaderMarkDownItem
You can inject your new styling object by passing it to the constructor of the MarkdownTextView
MarkDownTextView(styling: CustomMarkyMarkStyling())
Adding your own rules
Adding a new rule requires three new classes of based on the following protocol:
Rule
that can recoginizes the desired markdown syntaxMarkDownItem
for your new element that will be created by your new ruleLayoutBlockBuilder
that can convert your MarkDownItem to layout
Add the rule to MarkyMark
markyMark.addRule(MyCustomRule())
Or when using the MarkdownTextView:
markdownTextView.add(rule: MyCustomRule())
Add the block builder to your layout converter
converter.addLayoutBlockBuilder(MyCustomLayoutBlockBuilder())
Or when using the MarkdownTextView use either of these options (depending on the configuration view or attributedString):
markdownTextView.addViewLayoutBlockBuilder(MyCustomLayoutBlockBuilder())
markdownTextView.addAttributedStringLayoutBlockBuilder(MyCustomLayoutBlockBuilder())
If needed you can also add a custom styling class to the default styling
styling.addStyling(MyCustomStyling())
Converter hook
The converter has a callback method which is called every time a MarkDownItem
is converted to layout.
converter.didConvertElement = {
markDownItem, view in
// Do something with markDownItem and / or view here
}
When using the MarkdownTextView
markDownTextView.onDidConvertMarkDownItemToView = {
markDownItem, view in
}
Link behavior
By default Markymark opens URL's using UIApplication.shared.delegate.open(_:open:options)
. links will only be openened when this method is implemented. Markymark allows changing this behavior by passing a custom URLOpener, an object that conforms to the URLOpener
protocol.
let markDownView = MarkDownTextView()
markDownTextView?.urlOpener = MyCustomerURLOpener()
Using Markymark in Extensions
Markymark also supports usage the a Today extension. By default tapping url's is not working, since Extensions don't have access to UIApplication.shared, in order to support links you can pass a different url opener to a MarkyDownTextView. See the Example project for a working example:
markDownTextView?.urlOpener = ExtensionContextURLOpener(extensionContext: self.extensionContext)
Author
M2mobi, [email protected]
License
MarkyMark is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the Marky Mark README section above
are relevant to that project's source code only.