Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Indexes not being UTF16 (Emoji bug) #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wes-nz
Copy link

@wes-nz wes-nz commented Mar 8, 2018

📝 Description

Having emoji breaks the parsing. The Indexes used were not UTF16.
This is fixing the issue #28 / #29

👎 Existing Behaviour

let breakingString = " *hello* .  *hello*  cncnc cncnc  *hello*  hmm\n  *hello*  🦌🐎🦌🐎\n  *hello*  Screen Shot 2017-10-12 at 11.04.58 AM.png  *hello*  vVe2keakU8.gif  *hello*   *hello* "
var parser: Parser = {
    let parser = Parser()

    parser.add(pattern: MDBoldPattern()) { (string, attributes) -> MatchedResponse in
        return MatchedResponse(string: string, attributes: [NSAttributedStringKey.font: NSFont.boldSystemFont(ofSize: 20)])
    }
    
    parser.add(pattern: MDEmphasisPattern()) { (string, attributes) -> MatchedResponse in
        return MatchedResponse(string: string, attributes: [NSAttributedStringKey.font: NSFont.boldSystemFont(ofSize: 20)])
    }
        
    return parser
}()

screen shot 2018-03-09 at 8 44 48 am

👍 Expected Behaviour Now

screen shot 2018-03-09 at 10 13 46 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant