Support for checkboxes
Markdown supports checkboxes and Folio should be able to show a simple checkbox when [] is typed.
Check boxes are part of the extended markdown that github uses, but should be able to do something with them. There are limitations due to the sourceview control that is used to do the editing/display so they won't be perfect.
I'd like to contribute to this project and I've attempted to add support for this. So with a bit of printing I can tell that the regex successfully matches the task item.
I am completely unsure of how to use the correct styling.
If I do text_tag_task.indent = 64;
It still seems to be on the same visual indentation level as text_tag_list.indent = 16;
I have a slight suspicion that it applies the list style first, since that'll match what's being typed first.
Anyways, this should provide a solid base for adding checkboxes, as I've kept the format and styling exactly like the current source code. It ain't much but it's honest work.
~~https://github.com/BenStigsen/Folio/tree/tasklist~~
@BenStigsen Yes, since checkbox lines are just list lines, that will be the issue with the indenting.
Based on your code I'm not sure what the benefit is to adding this style of implementation, it will do the exact same formatting as a list item, and as you mentioned, the list item will get matched before the checkbox line anyway.
My current though is to look at implementing two additional features for checkbox's:
- click to check/uncheck (should be doable like the ctrl-click to follow link code)
- there is support in the gtk.textbuffer code for inserting images, so technically Folio could hide the "[ ]/[x]" text and insert a more graphical checkbox (though it will have to be stripped out on save)
With those features, making a separate format for them makes more sense I think.
Yeah that makes sense, oddly enough I hadn't considered being able to click on the checkbox. But checkbox images would definitely be much nicer than the raw text based one.
Meanwhile, this is the workaround I use: ☐ (U+2610) and ☒ (U+2612) if you have an easy way to enter Unicode characters (Ctrl-Shift-u on Ubuntu, for example).