<!--
{
  "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/MarkdownDecodableAttributedStringKey",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation36MarkdownDecodableAttributedStringKeyP"
  },
  "title" : "MarkdownDecodableAttributedStringKey"
}
-->

# MarkdownDecodableAttributedStringKey

A protocol that defines how an attribute key decodes a value that corresponds to Markdown syntax.

```
protocol MarkdownDecodableAttributedStringKey : AttributedStringKey
```

## Overview

This protocol is separate from [`DecodableAttributedStringKey`](/documentation/Foundation/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`](/documentation/Foundation/AttributeScopes/FoundationAttributes/InflectionRuleAttribute) that conforms to [`MarkdownDecodableAttributedStringKey`](/documentation/Foundation/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 ``doc://com.apple.foundation/documentation/Foundation/AttributedString/init(markdown:options:baseURL:)-52n3u``, be sure to set the ``doc://com.apple.foundation/documentation/Foundation/AttributedString/MarkdownParsingOptions/allowsExtendedAttributes`` option. If you don’t include this option, the string won’t parse ``doc://com.apple.foundation/documentation/Foundation/MarkdownDecodableAttributedStringKey``-based attributes.

## Topics

### Decoding Values

[`decodeMarkdown(from:)`](/documentation/Foundation/MarkdownDecodableAttributedStringKey/decodeMarkdown(from:))

Decodes a value from the provided decoder.

### Accessing the Markdown Name

[`markdownName`](/documentation/Foundation/MarkdownDecodableAttributedStringKey/markdownName)

The Markdown name associated with an attributed string key.



---

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)