Initializer

init(markdown:options:baseURL:)

Creates an attributed string from a Markdown-formatted string using the provided options. ある属性付き文字列を作成します、Markdown書式設定された文字列から、この提供されたオプションを使って。

Declaration 宣言

init(markdown: String, options: AttributedString.MarkdownParsingOptions = .init(), baseURL: URL? = nil) throws

Parameters パラメータ

markdown

The string that contains the Markdown formatting. Markdown書式設定を含む文字列。

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 Strings