Okay, so the basic idea is markdown but customizable…
Often I want a section of text to be bold, but I'm also making a byline with strange kerning, or a strikeout with different opacity, etc.
I envision a system for defining markdown codes with coresponding styles per NSAttributableString
(this class could be subclassed to persist styles, ala NSProductHeaderString
, etc)
So imagine we have a string like: "Hello, well aren't you bold." where we want to bold the last word.
With NSAttributedString
we either have to hardcode the NSRange
or do a substring look-up at run-time to generate a NSRange
to apply the bold style, or just append the bold string with its bolding attribute. None are concise or easy to understand and change.
Now imagine we define styles:
NSDictionary *styles = @{