Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/michaelnisi/hattr
- Owner: michaelnisi
- License: mit
- Created: 2016-08-09T15:51:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-13T08:16:44.000Z (over 4 years ago)
- Last Synced: 2024-10-13T18:45:31.404Z (2 months ago)
- Language: Swift
- Size: 69.3 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 HTMLAttributorlet 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)