Open vincent-peugnet opened 1 year 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.
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
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: