Repository navigation
Releases: AppleArealidea/ARMarkdownTextStorage
Release list
2.0.3
2.0.3 — Range safety: fix out-of-bounds crash on text input
Fixes a fatal NSRangeException (NSMutableRLEArray ... Out of bounds) thrown from MarkdownTextStorage while typing in a UITextView.
Fixed
The UIKit text-input subsystem (predictive text, dictation, marked text) could hand MarkdownTextStorage a range whose end exceeded the backing store length before the store had caught up. Forwarding it straight to NSMutableAttributedString crashed the host app.
All NSTextStorage primitives now clamp incoming ranges/locations to the real backing store length: replaceCharacters(in:with:), attributes(at:effectiveRange:), setAttributes(_:range:). edited(...) bookkeeping stays consistent with the range actually applied.
Added
SwiftPM test target with range-safety regression tests (out-of-bounds replace/attributes/setAttributes, empty store, negative location, in-bounds sanity).
No public API changes — fully source-compatible with 2.0.2.
2.0.2
2.0.1
2.0.0
Release 2.0.0
Breaking Changes
- Renamed
MarkdownParser.attributedString(fromMardown:...)→attributedString(fromMarkdown:...)— fixed typo in the parameter label - Renamed return tuple label
isCutted→isTruncatedinMarkdownParser.attributedString(...) - Removed
NSObjectinheritance fromMarkdownParser backingStoreinMarkdownTextStorageis nowprivate(was previously accessible)
Bug Fixes
- Fixed bold and italic styles not combining correctly — italic trait from the existing font was ignored when overlaying a new style
- Fixed
performReplacementsForRangelosing the expanded line range on multi-line edits - Fixed
setDefaultFont(_:)not rebuilding highlight patterns after a font change
Crash Fixes
- Fixed potential crashes from force unwraps in
createAttributesForFontandfontWithBoldTraitwhen a font does not support requested traits — now safely falls back to the original or system font
Improvements
- Cached compiled
NSRegularExpressioninstances in highlighters instead of recompiling on every editing pass - Added proper
beginEditing()/endEditing()wrapping insetDefaultFont(_:) - Added
platforms: [.iOS(.v13)]toPackage.swift - Updated README with full documentation, usage examples, and installation instructions
Migration Guide
// Before (1.x)
let (result, isCutted) = MarkdownParser.attributedString(
fromMardown: text, font: font
)
// After (2.0.0)
let (result, isTruncated) = MarkdownParser.attributedString(
fromMarkdown: text, font: font
)