Protocol

MarkdownDecodableAttributedStringKey

A protocol that defines how an attribute key decodes a value that corresponds to Markdown syntax.

Declaration 宣言

protocol MarkdownDecodableAttributedStringKey

Overview 概要

This protocol is separate from DecodableAttributedStringKey to separate explicit attributes defined by the SDK from Markdown’s semantic styling attributes. You use these attributes with Apple’s extended syntax for markdown: ^[text](attribute: value).

Using this protocol allows your markup names to differ from the names of your attributes. For example, the automatic grammar agreement feature uses markup like ^[text to inflect](inflect: true). This feature defines an AttributeScopes.FoundationAttributes.InflectionRuleAttribute that conforms to MarkdownDecodableAttributedStringKey. The value of its name proprerty is NSInflect, while its markdownName, used in actual Markdown strings like the one shown here, is inflect.

To define your own attributes for use with Markdown syntax, make sure your attributes conform to this protocol. The markdown parser ignores attributes that don’t conform, even if you use the extended Markdown syntax.

Topics 話題

Decoding Values

Accessing the Markdown Name