Skip to content

Instantly share code, notes, and snippets.

@seanho
Created July 28, 2025 23:46
Show Gist options
  • Select an option

  • Save seanho/9b11c2b0b1f6207bcbfe097e6e849603 to your computer and use it in GitHub Desktop.

Select an option

Save seanho/9b11c2b0b1f6207bcbfe097e6e849603 to your computer and use it in GitHub Desktop.
AttribuedString markdown parsing
let attrString = try AttributedString(markdown: markdown)
for (intentBlock, intentRange) in attrString.runs[\.presentationIntent] {
guard let intentBlock else { continue }
for intent in intentBlock.components {
switch intent.kind {
case .paragraph:
case let .header(level):
case .orderedList:
case .unorderedList:
case let .listItem(ordinal):
case let .codeBlock(languageHint):
case .blockQuote:
case .thematicBreak:
case let .table(columns):
case .tableHeaderRow:
case let .tableRow(rowIndex):
case let .tableCell(columnIndex):
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment