One Logo Pool Ball
Foundation · IOS API REFERENCE

MarkdownDecodableAttributedStringKey

protocol · iOS 15.0+ · SDK 27.1

protocol MarkdownDecodableAttributedStringKey : AttributedStringKey

A protocol that defines how an attribute key decodes a value that corresponds to Markdown syntax. 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 ``AttributeScopes/FoundationAttributes/InflectionRuleAttribute/name`` proprerty is `NSInflect`, while its ``AttributeScopes/FoundationAttributes/InflectionRuleAttribute/markdownName-aom1``, 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. > Tip: > When creating attributed strings from Markdown-based initializers like ``AttributedString/init(markdown:options:baseURL:)-52n3u``, be sure to set the ``AttributedString/MarkdownParsingOptions/allowsExtendedAttributes`` option. If you don't include this option, the string won't parse ``MarkdownDecodableAttributedStringKey``-based attributes.

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

MarkdownDecodableAttributedStringKey.markdownName

Static protocol requirements cannot be called through an instance.

MarkdownDecodableAttributedStringKey.decodeMarkdown(from:)

Static protocol requirements cannot be called through an instance.

All Foundation types →