Latest 0.0.1
Homepage https://github.com/chriscdn/RHMarkdownLabel
License MIT
Platforms ios 8.0, requires ARC
Dependencies TTTAttributedLabel, XNGMarkdownParser
Authors

Introduction

RHMarkdownLabel is UILabel replacement for supporting markdown. RHMarkdownLabel provides a -setMarkdown:method, which transparently converts the markdown string to an NSAttributedString and display it in the label. For example:

NSString *md = @"This is **bold**.";
[self.myLabel setMarkdown:md];

Most of the logic behind RHMarkdownLabel is contained in its two dependencies. RHMarkdownLabel is a subclass of TTTAttributedLabel and uses XNGMarkdownParser
to parse and convert the markdown to an NSAttributedString. RHMarkdownLabel is just the glue between these repositories.

Installation

CocoaPods makes it easy to install to your project. Edit your Podfile and add:

pod 'RHMarkdownLabel'

Handling Links

RHMarkdownLabel provides a block interface for handling tapped links (instead of using the delegate pattern of TTTAttributedLabel). For example:

[self.myLabel setDidSelectLinkWithURLBlock:^(`RHMarkdownLabel` *label, NSURL *url) {
    NSLog(@"The user tapped on %@.", url.absoluteString);
}];

Block for other types such as addresses, phone numbers, dates, and transit information are still pending.

NSString+markdown.h Category

RHMarkdownLabel also contains an NSString category for processing markdown strings.

License

RHMarkdownLabel is available under the MIT license. See the LICENSE file for more information.

Latest podspec

{
    "name": "RHMarkdownLabel",
    "version": "0.0.1",
    "summary": "RHMarkdownLabel is a UILabel replacement that supports markdown.",
    "homepage": "https://github.com/chriscdn/RHMarkdownLabel",
    "license": "MIT",
    "authors": {
        "Christopher Meyer": "[email protected]"
    },
    "source": {
        "git": "https://github.com/chriscdn/RHMarkdownLabel.git",
        "tag": "0.0.1"
    },
    "social_media_url": "https://twitter.com/chriscdn",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "RHMarkdownLabel/*",
    "dependencies": {
        "TTTAttributedLabel": [],
        "XNGMarkdownParser": []
    }
}

Pin It on Pinterest

Share This