<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAttributedString/init(markdown:options:baseURL:)-5nru2",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So18NSAttributedStringC10FoundationE8markdown7options7baseURLAbC4DataV_AC010AttributedB0V22MarkdownParsingOptionsVAC0G0VSgtKcfc"
  },
  "title" : "init(markdown:options:baseURL:)"
}
-->

# init(markdown:options:baseURL:)

Creates an attributed string from Markdown-formatted data using the provided options.

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

## Parameters

`markdown`

The [`Data`](/documentation/Foundation/Data) instance that contains the Markdown formatting.

`options`

Options that affect how the initializer interprets formatting in the Markdown string. This parameter defaults to no options.

`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`.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)