Add support for markdown "checkboxes" #36

Closed
evolutionxbox opened this Issue Nov 1, 2016 · 14 comments

Projects

None yet

3 participants

@evolutionxbox
evolutionxbox commented Nov 1, 2016 edited

When submitting an issue here on github, I am able to make lists with "checkboxes" which can be checked/unchecked.

For example, using:

- [ ] an example issue
- [x] a completed issue

will output:

  • an example issue
  • a completed issue

Can a similar feature be added (without the fancy rendering)?
Where one can insert a "checkbox" using a keyboard shortcut, and then check/uncheck it using another?


Example screenshot:

screen shot 2016-11-01 at 15 53 45

@Kilian
Owner
Kilian commented Nov 1, 2016

I've had this on my personal list as well! I like it a lot but haven't looked into it yet as it's changing text content. If it's doable in a non-hacky way, I'll try and add it.

@Kilian Kilian added the enhancement label Nov 1, 2016
@Kilian
Owner
Kilian commented Nov 1, 2016

Any suggestions for the keyboard shortcut(s)?

@evolutionxbox
evolutionxbox commented Nov 3, 2016 edited

Maybe something like cmd+., or cmd+/, to toggle them on and off?

As for inserting a new checkbox, evernote uses cmd+shift+t, but I think that's too many keys.

It could be that pressing cmd+/ inserts a new checkbox, and then subsequently toggles it.

@Kilian
Owner
Kilian commented Nov 4, 2016

I like the idea of spacebar to toggle, that keeps it consistent with html checkboxes. however that should only work when you are between [ ]. Would you expect cmd+. to work wherever you are on a line?

@Kilian
Owner
Kilian commented Nov 7, 2016

Just pushed this to the checkbox-support branch. if you press ctrl + /, it will add an empty checkbox to the beginning of the current line (prepended by any whitespace you already have, so indented lists work) . pressing ctrl + / again will toggle the checkbox to checked and unchecked.

checkboxes

What this doesn't do is append the checkbox after any "list" items such as * or -, it will instead add the checkbox before the list item but after any whitespace at the beginning of the line. To me this looks better (and it's less code to write and maintain, so double win). Let me know what you think @evolutionxbox!

@evolutionxbox

I really like this. I'm going to checkout that branch later today and have a play around. Personally I think you've got a good approach.

@Kilian
Owner
Kilian commented Nov 12, 2016

Just pushed support for interaction with selections too: select multiple lines and press ctrl + / and it will add/toggle checkboxes on all of them.

@nkantar
nkantar commented Nov 19, 2016

I'm using FromScratch as my to-do scratchpad (it feels like a much nicer macOS Stickies), and I'm really looking forward to this in stable. 👍

Supporting list-style checkboxes may be useful for those who want Markdown in the end, but I think I can live without them.

@Kilian
Owner
Kilian commented Nov 20, 2016

What are list-style checkboxes?

@nkantar
nkantar commented Nov 21, 2016

The GitHub flavored Markdown syntax of:

- [ ] one
- [ ] two
    - [ ] three
- [x] four
- [ ] five

...which they render as so:

  • one
  • two
    • three
  • four
  • five
@Kilian
Owner
Kilian commented Nov 21, 2016

Ah, yes. We're not going to render checkboxes as html, they will remain plain text. IMO the dash is superfluous:

[ ] one
[ ] two
    [ ] two point one
[ ] three

Reads just as well, right? See my comment here for rationale: #36 (comment)

@evolutionxbox

@Kilian yeah I agree with you. The checkboxes do not need to render.

@nkantar
nkantar commented Nov 21, 2016 edited

Yes, it reads fine, but isn't great for copy/pasting into Markdown files.

And just to be clear, I don't think FromScratch should render them as HTML — I'd just personally prefer - [ ] one over [ ] one.

That said, it's perfectly fine for FromScratch not to bother with that, as it's not a Markdown editor (and doesn't want to be one). If I end up needing something like this, processing text is easy enough to script.


Edit: I just realized FromScratch doesn't support italicizing or bolding text in a Markdown(-like) manner anyway (which I probably just assumed it does for no good reason), so this whole thing is a bit silly. If it's meant to remain a plain-text scratchpad, it's fine as it is (though 👍 for the checkbox keyboard shortcuts).

@Kilian
Owner
Kilian commented Nov 27, 2016

Just merged this back to master, will be in 1.3.0!

@Kilian Kilian closed this Nov 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment