CommonMarkAttributedString icon indicating copy to clipboard operation
CommonMarkAttributedString copied to clipboard

Custom attributes

Open mikepulaski opened this issue 4 years ago • 1 comments

I think it'd be neat to be able to provide custom attributes when creating attributed strings. For example, a chat application might want to make headers bold without altering the size, or a note-taking application might want to render links with a specific a tint color.

I think this could be done fairly easily by adding an optional parameter (where appropriate) such that the existing API signature(s) don't change and the current attributes are used as default values.

Do you have any thoughts on this? I'd be happy to make a PR (plus any tweaks based on your feedback) if this is something you'd like upstream.

Thanks again for sharing!

mikepulaski avatar Apr 02 '20 01:04 mikepulaski

Here's another scenario I encountered where customizable attributes could be handy. It seems that the attributed string doesn't handle line breaks properly, but I can't override the library's attributes to fix it :(

It has **bold** and _italic_.

# Here's a header

> With some content
> in a quote

Very interesting. [view source](#)

## Here's a sub header

- we
- have
- lists

1. they
2. can
3. be
4. ordered
Screenshot 2020-04-03 at 16 35 02

mikepulaski avatar Apr 03 '20 15:04 mikepulaski