static func decodeMarkdown (from: Decoder) -> Self.Value
Overview 概要
This protocol is separate from Decodable
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 Attribute
that conforms to Markdown
. The value of its name
proprerty is NSInflect
, while its markdown
, 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 init(markdown:
, be sure to set the allows
option. If you don’t include this option, the string won’t parse Markdown
-based attributes.