<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAttributedString/Key/markdownSourcePosition",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@NSMarkdownSourcePositionAttributeName"
  },
  "title" : "markdownSourcePosition"
}
-->

# markdownSourcePosition

The position in a Markdown source string corresponding to some attributed text.

```
static let markdownSourcePosition: NSAttributedString.Key
```

## Discussion

This attribute indicates the position in the Markdown source where a run of attributed text begins and ends, omitting markup characters in the source. For example, after parsing the source string `“This is *emphasized*.”`, the text `emphasized` has a Markdown source position that starts at column `10`. This index is the `“e”` character, not the `“*”` formatting character.

An attributed string parsed from Markdown text includes this attribute only if the [`appliesSourcePositionAttributes`](/documentation/Foundation/NSAttributedStringMarkdownParsingOptions/appliesSourcePositionAttributes) value in the directory of [`NSAttributedString.DocumentReadingOptionKey`](/documentation/Foundation/NSAttributedString/DocumentReadingOptionKey) options provided to the [`NSAttributedString`](/documentation/Foundation/NSAttributedString) initializer is `YES`.

---

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)