Markdown-annotating version of TextEditor using AttributedString features in iOS/macOS 26. Based on initial implementation of ComposerUI in IcySky by @Dimillian.
.package(url: "https://github.com/fraander/AttributedTextEditor.git")import AttributedTextEditor@State var text = AttributedString()
@State var selection = AttributedTextSelection()
var body: some View {
ComposerTextEditorView(text: $text, selection: $selection)
}var body: some View {
ComposerView()
}-
ComposerToolbarView.swiftbuttons don't actually work yet. Working versions that make the selection jump to the end have been found, but that's not good enough. -
.linkpattern matches aren't clickable, yet.- Clickable phone numers and email addresses is another goal. In addition to fuzzier link recognition, so
https://www.isn't always required to make something clickable if not using the Markdown annotation version.
- Clickable phone numers and email addresses is another goal. In addition to fuzzier link recognition, so
- The rest of a line for a checked box can't be matched successfully yet, so the rest of the line can't be dimmed, striked through, etc.
- Copy button cannot yet support copying rich-text version of the string, just plain text.
- Placeholder placement on MacOS is incorrect and needs to be tuned.
- Extensibility / user-adjustability in what patterns can be matched and what appearance the matches adopt, so that others can use the spec for their needs, such as the original which was annotating
@mentionsandwww.links.co
I know that this isn't perfect adherence to the Markdown specification. It's been slightly adjusted based on personal preference. Ideally, the project evolves such that many options are available to pick from, and any that aren't available can be addressed by user-created extensions.
- Bold:
*bold* - Italic:
_italic_ - Link:
[link](https://www.github.com/fraander)(Not clickable, yet) - Blockquote:
> blockquote - Underline:
__underline__ - Strikethrough:
~strikethrough~ - Heading 1:
# Heading 1 - Heading 2:
## Heading 2 - Heading 3:
### Heading 3 - Unordered list:
-,+,* - Ordered list:
1. - Checkbox:
- [ ],- [x](Having trouble adjusting the rest of the line, following- [x]) - Inline code:
[backtick]code[backtick] - Code block:
```code block```
|
