Skip to content

Releases: AppleArealidea/ARMarkdownTextStorage

2.0.3

Choose a tag to compare

@AppleArealidea AppleArealidea released this 17 Jun 12:33

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

Choose a tag to compare

@AppleArealidea AppleArealidea released this 10 Jun 11:53

Full Changelog: 2.0.1...2.0.2

2.0.1

Choose a tag to compare

@AppleArealidea AppleArealidea released this 06 May 13:10

Full Changelog: 2.0.0...2.0.1

2.0.0

Choose a tag to compare

@AppleArealidea AppleArealidea released this 31 Mar 15:17

Release 2.0.0

Breaking Changes

  • Renamed MarkdownParser.attributedString(fromMardown:...) → attributedString(fromMarkdown:...) — fixed typo in the parameter label
  • Renamed return tuple label isCutted → isTruncated in MarkdownParser.attributedString(...)
  • Removed NSObject inheritance from MarkdownParser
  • backingStore in MarkdownTextStorage is now private (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 performReplacementsForRange losing 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 createAttributesForFont and fontWithBoldTrait when a font does not support requested traits — now safely falls back to the original or system font

Improvements

  • Cached compiled NSRegularExpression instances in highlighters instead of recompiling on every editing pass
  • Added proper beginEditing()/endEditing() wrapping in setDefaultFont(_:)
  • Added platforms: [.iOS(.v13)] to Package.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
)

1.0.2

Choose a tag to compare

@AppleArealidea AppleArealidea released this 18 Mar 11:49

1.0.1

Choose a tag to compare

@AppleArealidea AppleArealidea released this 05 Feb 13:04

Memory usage optimization

1.0.0

Choose a tag to compare

@AppleArealidea AppleArealidea released this 16 Aug 09:35
ARMarkdownTextStorage version 1.0.0