Comments (1)
Ivan, after going through your codebase, I found the specific section where the incorrect parsing logic occurs. I can't figure out how to fix it (yet). It's in the method match(_:attributedString:)
within MarkdownCodeEscaping.swift
file. I did print statement for matchString
and escapedString
variables as such:
open func match(_ match: NSTextCheckingResult, attributedString: NSMutableAttributedString) {
let range = match.rangeAt(2)
// escaping all characters
let matchString = attributedString.attributedSubstring(from: range).string
// ******
print("matchString:\(matchString)")
// ******
let escapedString = Array<UInt16>(matchString.utf16)
.map { (value: UInt16) -> String in String(format: "%04x", value) }
.reduce("") { (string: String, character: String) -> String in
return "\(string)\(character)"
}
// *****
print("escapedString:\(escapedString)")
// *****
attributedString.replaceCharacters(in: range, with: escapedString)
}
And I got the following in the console log:
matchString:this is how you highlifht code
escapedString:007400680069007300200069007300200068006f007700200079006f007500200068006900670068006c006900660068007400200063006f00640065
Here's the accompanying shots:
Here's the accompanying shots:
from markdownkit.
Related Issues (20)
- Used to Swiftui
- Crash when trying to parse this string: [()]
- support checklist
- Fails to parse markdown starting or ending with a whitespace
- How to render tables HOT 1
- Which markdown spec does this library follow?
- Blur links
- Multi formatted word parsing
- Does this SDK need a Privacy Manifest? HOT 1
- Readme is outdated
- I want to support strike through with like this ~text~ instead of ~~text~~
- [question] Custom element with custom view
- App Crash on MarkdownLink.formatText() HOT 3
- Links and parentheses don't work well together
- Errors occur when installing via Swift Package Manager HOT 2
- Carthage Install Failing HOT 2
- Right-to-left support
- Combination of italic with custom markdown element not working HOT 4
- Bad parsing result
- Three ticks and new lines
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdownkit.