Git Product home page Git Product logo

ashton's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ashton's Issues

lineHeightMultiple

Thank your for this amazing API.
Could you please add support for ".lineHeightMultiple" it's a part of ( NSMutableParagraphStyle key )

To adjust line height

Unknown Font Handling

Parsing an unknown font returns and AttributedString with a fallback font. Roundtripping overrides the unknown font in the html.

Cocoapods spec

Please add a cocoapods spec for easier integration into projects

support cocoapods

Hi,
Please support installation via cocoapods, this method can solve the compatibility problem of m1 chip. Thank you.

Image handling

If there a way to include an Image in the NSAttributedText to be converted to HTML?

Thanks

Tag recent commits?

Could we tag the recent commits on master as a release or is there some reason against it?

Uncompatible with iOS < 6

From my test using Ashton on ios 5.x it crashes with EXC_BAD_ACCESS because you're using NSAttributedString constants from iOS 6: https://github.com/pinguet62/SMSToXMPPiOSApp/blob/master/Frameworks/UIKit.framework/Headers/NSAttributedString.h

I only use the html to NSAttributedString for iOS and I've fixed the area where my app crashed: https://github.com/cristianbica/Ashton

So either you're going to modify the podspec compatibility for iOS to version 6 or we're going to implement support for iOS 5 also.

Headers support

Can I with Ashton make header support?
I see there is no ashton intermediate header representations.
If i read <b>Wow!</b> Now <em>iOS</em> can create <h3>NSAttributedString</h3> from HTMLs! markdown output would be "**Wow**! Now *iOS* can create\n\n**NSAttributedString**\n\nfrom HTMLs!\n\n" but it will be cool if output can be the same as input string.

Sorry, I'm not quite understand how attributedString work yet.
Thanks.

How performant is this compared to the the native decoding of html?

You can convert html String to NSAttributedString the native way like this:

let htmlString = "some html string"
guard let data = htmlString.data(using: String.Encoding.utf16, allowLossyConversion: false) else {
            return nil
        }

guard let attributedString = try? NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil) else {
 return nil
}

let attributedString = NSAttributedString(attributedString: attributedString)

Have you done any benchmark of Ashton vs this method?

Correctly handle control characters in HTML output

Ashton currently ignores characters like \u000d \u0009 \u000c \u0085 \u2028 \u2029 and leaves them in the output. This can cause issues when displaying the string in a web browser as the web browser will ignore the line separator or paragraph separator character. The correct solution would be to for example replace them with

Xcode 12.5 Warning

/Ashton/Sources/Ashton/AshtonXMLParser.swift:17:35: Using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.