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

Customise each markdown element #8

Description

@larryonoff

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 {
    ...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions