vincent-peugnet / wcms

⧉ light-weight experimental wiki
http://w.club1.fr
GNU Affero General Public License v3.0
20 stars 5 forks source link

GFM for checkbox list #257

Open vincent-peugnet opened 1 year ago

vincent-peugnet commented 1 year ago

add support for GFM.

As W is supposed to be a note taking tool, the checkbox list might be usefull. But for this to work, I will need to change the markdown library.

OR

use only php and generate a form submit button :sunglasses:

vincent-peugnet commented 1 month ago

I fought that I could tried to do it using the line number. In the markdown content view, if I limit the checkbox to one per line and detect the pattern - [ ], I could add the line number as an HTML attribute. So the JS could use it to target the good checkbox, while editing the content.

I could replace only the checkbox [ ] or [x] part and let the markdown parser do the rest (list) This has to be done first so the line number is not lost.

For the API part, I could have a checkboxtoggle route that would read pageID, line and checked params.

vincent-peugnet commented 1 month ago

Mmhh... Geting the line-number seems to be a bit more complicated than I fought.

https://stackoverflow.com/questions/4730867/get-line-number-from-preg-match-all https://stackoverflow.com/questions/3560640/is-it-possible-to-show-line-numbers-when-using-a-regex-in-php