Generic Initializer

init(markdown:including:options:baseURL:)

Creates an attributed string from Markdown-formatted data using the provided options and attribute scope that a key path identifies. ある属性付き文字列を作成します、Markdown書式設定されたデータから、この提供されたオプションとあるキーパスが識別する属性スコープを使って。

Declaration 宣言

init<S>(markdown: Data, including scope: KeyPath<AttributeScopes, S.Type>, options: AttributedString.MarkdownParsingOptions = .init(), baseURL: URL? = nil) throws where S : AttributeScope

Parameters パラメータ

markdown

The Data instance that contains the Markdown formatting. Markdown書式設定を含むDataインスタンス。

scope

The AttributeScopes key path that identifies an attribute scope to associate with the attributed string. 属性付き文字列と結びつけることになるある属性スコープを識別するAttributeScopesキーパス。

options オプション

Options that affect how the initializer interprets formatting in the Markdown string. This parameter defaults to no options. どのようにイニシャライザがMarkdown文字列における書式設定を解釈するかに影響を及ぼすオプション。このパラメータは省略時にはオプション無しになります。

baseURL

The base URL to use when resolving Markdown URLs. The initializer treats URLs as being relative to this URL. If this value is nil, the initializer doesn’t resolve URLs. The default is nil. Markdown URLを解決するときに使う基底URL。イニシャライザは、URLをこのURLに相対的であるとみなします。この値がnilならば、イニシャライザはURLを分析しません。省略時にはnilです。

Discussion 議論

If your source string includes custom attributes defined by conformers to MarkdownDecodableAttributedStringKey and used with Apple’s markdown extension syntax, be sure to include the allowsExtendedAttributes option. Otherwise, the initializer doesn’t parse these attributes.

See Also 参照

Initializing from Markdown Data