Skip to content

Create NSAttributedStrings from NSStrings with lightweight Mush markup

License

Notifications You must be signed in to change notification settings

sobri909/MGMushParser

Repository files navigation

MGMushParser

Create anNSAttributedStringfrom anNSStringwith lightweightMushmarkup.

  • Boldis achieved with **double asterisks**
  • Italicsare achieved with //double slashes//
  • Underlining is achieved with __double underscores__
  • Monospacingis achieved with `single backticks`
  • Strikethroughis achieved with ~double tildes~
  • Coloured text is achieved with {#123456|the coloured text}
  • Set text background colour with {bg#123456|the text}
  • Adjust kerning with {k4.5|the more widely spaced text}
  • Change font with {font:HelveticaNeue,12pt|text in a different font}

CocoaPods Setup

pod 'MGMushParser'

Example

NSString*mush =@ "this string has **bold**, //italics//, and {#ff0000|red text}";

NSAttributedString*result = [MGMushParserattributedStringFromMush:mush
font:[UIFontfontWithName:@ "Helvetica"size:14]color:UIColor.blackColor];

About

Create NSAttributedStrings from NSStrings with lightweight Mush markup

Resources

License

Stars

Watchers

Forks

Packages

No packages published