Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Customise each markdown element #8

Open
larryonoff opened this issue Aug 13, 2021 · 0 comments
Open

Customise each markdown element #8

larryonoff opened this issue Aug 13, 2021 · 0 comments

Comments

@larryonoff
Copy link

Hello,

It's important to be able to customise markdown elements with needed attributes. So I would like to suggest breaking API change. See the code sample below.

Does it fit with the idea of the current framework?

public struct Attributes {
    public var blockQuote: [NSAttributedString.Key : Any]?
    public var codeBlock: [NSAttributedString.Key : Any]?
    public var emphasis: [NSAttributedString.Key : Any]?
    public var heading1: [NSAttributedString.Key : Any]?
    public var heading2: [NSAttributedString.Key : Any]?
    public var heading3: [NSAttributedString.Key : Any]?
    public var heading4: [NSAttributedString.Key : Any]?
    public var heading5: [NSAttributedString.Key : Any]?
    public var heading6: [NSAttributedString.Key : Any]?
    public var list: [NSAttributedString.Key : Any]?
    public var listItem: [NSAttributedString.Key : Any]?
    public var link: [NSAttributedString.Key : Any]?
    public var strong: [NSAttributedString.Key : Any]?
    public var text: [NSAttributedString.Key : Any]?
}

public convenience init(
    commonmark: String,
    attributes: Attributes? = nil,
    attachments: [String: NSTextAttachment]? = nil
) throws {
    ...
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant