[go: up one dir, main page]

Skip to content

rlaguilar/Markdowner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdowner

CI Status Version License Platform

Markdowner is a library intended to edit and preview markdown in real time. It supports custom markdown elements or use only a subset of the standard ones. Custom fonts and colors are also supported.

Preview of Library Demo

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Requires iOS 10 or later and Swift 4.1 or later.

Installation

Markdowner is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Markdowner'

How to use it

The main entry point ot use Markdowner is using the custom type MarkdownTextView, which is just a sublcass of UITextView.

var textView = MarkdownTextView(frame: parentView.bounds)
parentView.addSubview(textView)
textView.frame = ... // setup text view position inside its parent
textView.text = ... // set the initial markdown to display, if any

If you want to customize the default look of the markdown elements, you can use the class StylesConfiguration.

textView.stylesConfiguration = StylesConfiguration(
    baseFont: UIFont.systemFont(ofSize: 18),
    textColor: UIColor.darkGray,
    symbolsColor: UIColor.red
)

Creating custom elements is as simple as subclassing the type MarkdownElement, and then calling the function textView.use(elements: [MarkdownElement]) passing as arguments the list of markdown elements that you want to use. As a guide for creating new elements you could use any of the already implemented ones inside the folder Markdowner/Classes/Default Elements.

It's important to note that for now Markdowner doesn't support initialization from Storyboards.

Author

rlaguilar, rlac1990@gmail.com

License

Markdowner is available under the MIT license. See the LICENSE file for more info.

About

Live markdown previewer and editor

Resources

License

Stars

Watchers

Forks

Packages

No packages published