<commit_before># Marker

[![Travis build status](https://img.shields.io/travis/prolificinteractive/Marker.svg?style=flat-square)](https://travis-ci.org/prolificinteractive/Marker)
[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/Marker.svg?style=flat-square)](https://img.shields.io/cocoapods/v/Marker.svg)
[![Platform](https://img.shields.io/cocoapods/p/Marker.svg?style=flat-square)](http://cocoadocs.org/docsets/Marker)
[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/Marker.svg?style=flat-square)](http://cocoadocs.org/docsets/Marker)

## Description

Marker is a light wrapper for creating and setting `NSAttributedString` values.

## Requirements

* iOS 8.0+

## Installation

Marker is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your `Podfile`:

```ruby
pod "Marker"
```

## Usage

### TextStyle

Marker abstracts the most common attributed text properties into a data object called `TextStyle`, which it can use to create `NSAttributedString`s. A `TextStyle` can have:

* Text color
* Regular font
* Italic font
* Bold font
* Character spacing
* Line spacing
* Line height multiple
* Minimum line height
* Paragraph spacing
* Paragraph spacing before
* Text alignment
* Line break mode

`TextStyle` objects are a simple way of aggregating style infomation. For example:

```swift
var headlineTextStyle: TextStyle {
    
    let font: UIFont = UIFont.systemFontOfSize(23)
    let emFont: UIFont = UIFont.italicSystemFontOfSize(23)
    let strongFont: UIFont = UIFont.boldSystemFontOfSize(23)
    let characterSpacing: CGFloat? = 2
    
    return TextStyle(font: regularFont,
                     emFont: emFont,
                     strongFont: strongFont,
                     characterSpacing: characterSpacing)
    
}
```

### Setting Attributed Text

Marker has convenience extensions for setting `attributedText` on common UI elements: 

* `UILabel`
* `UITextField`
* `UITextView`

To set text on these elements, use `setText:textSyle`:

```swift
label.setText("Hello World", textStyle: headlineTextStyle)
```

#### Markdown

Marker also supports setting text with common Markdown tags:

* Bold (`__` or `**`)
* Italic (`_` or `*`)

To set Markdown text on these elements, use `setMarkdownText:textStyle:`

```swift
textField.setMarkdownText("_Hello World_", textStyle: headlineTextStyle)
```

## Contributing to Marker

To report a bug or enhancement request, feel free to file an issue under the respective heading.

If you wish to contribute to the project, fork this repo and submit a pull request. Code contributions should follow the standards specified in the [Prolific Swift Style Guide](https://github.com/prolificinteractive/swift-style-guide).

## License
<commit_msg>Updated the README for Swift 3<commit_after># Marker

[![Travis build status](https://img.shields.io/travis/prolificinteractive/Marker.svg?style=flat-square)](https://travis-ci.org/prolificinteractive/Marker)
[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/Marker.svg?style=flat-square)](https://img.shields.io/cocoapods/v/Marker.svg)
[![Platform](https://img.shields.io/cocoapods/p/Marker.svg?style=flat-square)](http://cocoadocs.org/docsets/Marker)
[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/Marker.svg?style=flat-square)](http://cocoadocs.org/docsets/Marker)

## Description

Marker is a light wrapper for creating and setting `NSAttributedString` values.

## Requirements

* iOS 8.0+

## Installation

Marker is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your `Podfile`:

```ruby
pod "Marker"
```

## Usage

### TextStyle

Marker abstracts the most common attributed text properties into a data object called `TextStyle`, which it can use to create `NSAttributedString`s. A `TextStyle` can have:

* Text color
* Regular font
* Italic font
* Bold font
* Character spacing
* Line spacing
* Line height multiple
* Minimum line height
* Paragraph spacing
* Paragraph spacing before
* Text alignment
* Line break mode

`TextStyle` objects are a simple way of aggregating style infomation. For example:

```swift
var headlineTextStyle: TextStyle {
    
    let font: UIFont = UIFont.systemFontOfSize(23)
    let emFont: UIFont = UIFont.italicSystemFontOfSize(23)
    let strongFont: UIFont = UIFont.boldSystemFontOfSize(23)
    let characterSpacing: CGFloat? = 2
    
    return TextStyle(font: regularFont,
                     emFont: emFont,
                     strongFont: strongFont,
                     characterSpacing: characterSpacing)
    
}
```

### Setting Attributed Text

Marker has convenience extensions for setting `attributedText` on common UI elements: 

* `UILabel`
* `UITextField`
* `UITextView`

To set text on these elements, use `setText(_:using:)` function.

```swift
label.setText("Hello World", using: headlineTextStyle)
```

#### Markdown

Marker also supports setting text with common Markdown tags:

* Bold (`__` or `**`)
* Italic (`_` or `*`)

To set Markdown text on these elements, use `setMarkdownText(_:using:)` function.

```swift
textField.setMarkdownText("_Hello World_", using: headlineTextStyle)
```

## Contributing to Marker

To report a bug or enhancement request, feel free to file an issue under the respective heading.

If you wish to contribute to the project, fork this repo and submit a pull request. Code contributions should follow the standards specified in the [Prolific Swift Style Guide](https://github.com/prolificinteractive/swift-style-guide).

## License

{'fraction_non_alphanumeric': 0.11258515596988168, 'fraction_numerical': 0.0034062387952671206, 'mean_word_length': 4.512845849802371, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3238623', 'n_tokens_mistral': 1809, 'n_tokens_neox': 1685, 'n_words': 503}