SwiftDown icon indicating copy to clipboard operation
SwiftDown copied to clipboard

Support todo markup with custom control.

Open martindufort opened this issue 2 years ago • 4 comments

In Markdown, the syntax - [ ] allows you to create todo lists.

How difficult would it be to implement this syntax but with a custom renderer displaying a checkbox.

martindufort avatar Jun 01 '23 16:06 martindufort

I don't think it would be feasible right know, I've been using attributed text to render markdown styled text, it would be hard to include checkbox to it. 😔

qeude avatar Jun 01 '23 20:06 qeude

After reviewing how you do things, I was thinking of using an 'NSTextAttachment' for a certain range of characters within the attributedString. And thus replace the - [ ] with a checkbox image.

Here's the Apple doc about it: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextAttachments/Tasks/AddingAttachments.html

On a scale of 0-5, how easy would it be to implement that? I'm might give it a go and produce a PR.

martindufort avatar Jun 01 '23 21:06 martindufort

Hard to tell to be honest, but would be glad to review and accept your PR if you do so 💪

qeude avatar Jun 02 '23 07:06 qeude