Skip to content

Converts Markdown files and strings into NSAttributedString

License

Notifications You must be signed in to change notification settings

mleavy/SwiftyMarkdown

 
 

Repository files navigation

SwiftyMarkdown

SwiftyMarkdown converts Markdown files and strings into NSAttributedString using sensible defaults and a Swift-style syntax. It uses dynamic type to set the font size correctly with whatever font you'd like to use

Usage

Text string

let md = SwiftyMarkdown(string: "# Heading\nMy *Markdown* string")
md.attributedString()

URL

if let url = NSBundle.mainBundle().URLForResource("file", withExtension: "md"), md = SwiftyMarkdown(url: url ) {
	md.attributedString()
}

Customisation

md.body.fontName = "AvenirNextCondensed-Medium"

md.h1.color = UIColor.redColor()
md.h1.fontName = "AvenirNextCondensed-Bold"
md.italic.color = UIColor.blueColor()

Screenshot

Screenshot

About

Converts Markdown files and strings into NSAttributedString

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 91.8%
  • Ruby 7.0%
  • Objective-C 1.2%