Skip to content

jackpal/HTMLString

Repository files navigation

HTMLString

This class represents an HTML string. It can be used to create an AttributedString for displaying HTML text.

Usage

import HTMLString

struct MyStruct: Codable {
  var html: HTMLString?
}

struct MyView: View {
  let myStruct : MyStruct
  var body: some View {
    if let html = myStruct.html?.asSafeMarkdownAttributedString {
      Text(html)
    }
  }
}

Credits

This code was originally extracted from IceCubesApp

Versions

1.1.1

Unescape entities. RawText and markdownText no loger have escaped entities like &

1.1.0

Added HTMLString(html:String) intializer for intializing from a HTML string.

1.0.4

Upped iOS and related version minimum to 15 (the actual API at which AttributedString is available.)

1.0.3

  • Dropped iOS and related version minimum to 13.
  • Recognize and tags.
  • Limited support for
    tag.

1.0.2

  • Switched Package version to 5.7 (to work with Swift 5.7).

1.0.1

First version.

About

A Codable class representing an HTML string.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages