Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/michaelnisi/hattr

Attribute string from HTML
https://github.com/michaelnisi/hattr

Last synced: about 1 month ago
JSON representation

Attribute string from HTML

Awesome Lists containing this project

README

        

# hattr - parse HTML

The **hattr** iOS package provides a naΓ―ve HTML parser to efficiently transform HTML into attributed strings.

## Goals

- No dependencies except UIKit
- Offloadable from main thread
- Simple and fast

> 50X faster than `NSAttributedString.init(data:options:documentAttributes:)`

At least 50X less correct.

## Example

```swift
import HTMLAttributor

let hattr = HTMLAttributor()
let tree = try! hattr.parse(html)
let attributedText = try! hattr.attributedString(tree)
```

Find a runnable example in `HTMLPlayground.playground`.

## Install

πŸ“¦ Add `https://github.com/michaelnisi/hattr` to your package dependencies.

## License

[MIT License](https://raw.github.com/michaelnisi/hattr/master/LICENSE)