From Jack Gleeson to ~sircmpwn/sr.ht-dev
On Fri, Jul 22 2022 at 10:05:00 +0200, Drew DeVault <sir@cmpwn.com> wrote: > Ugh, that's annoying. The whole point of commonmark was to put a stop > to > all of these private vendor extensions It makes sense when you think about markdown libraries targeting things other than html. If you're targeting Latex and other targets at once, it'd be nice to have a common tag you can replace with the appropriate target element. If I had more of a horse in the race I'd reopen the 8 year old (!) discussion on including strikethrough in the spec.
From Jack Gleeson to ~sircmpwn/sr.ht-dev
Yeah. let me try scope this out a bit. Given the lack of javascript sitewide, we could approach it as a form. We could do something like: 1. User creates a block of text with a todo list. 2. When a user toggles a box, we trigger an endpoint like `/<owner>/<name>/<int:ticket_id>/<int:comment_id>/<int:changed_id>"` 3. The backend finds the text relating to the comment id in the db, greps for todo boxes, iterates until it finds the right "changed_id", then toggles that to the opposite of what it is now (i.e. [X/x] -> [ ], [ ] -> [x]), then saves that back to the db. 4. We then refetch the page, showing the updated text. This seems a bit brittle and state-dependent, but is straightforward. It also
From jack gleeson to ~sircmpwn/sr.ht-dev
This diff adds support for Github-style checkbox items. This will close out
the request at ~sircmpwn/todo.sr.ht#36. The syntax matches the accepted
Github syntax:
[ ] Sample unchecked box.
[x] Sample checked task.
[X] We support this too.
The checkboxes are added using a SpanToken to keep this a small change.
Implementing this type of list as a separate BlockToken is a bigger can of
worms, and I don't think the game is worth the candle. This does also mean
that checkboxes can be added inline to a paragraph.
The checkbox syntax isn't CommonMark compliant, but it is a todo related
to todo.sr.ht, and a common/accepted usage from Github so I figure this
[message trimmed]
From jack gleeson to ~sircmpwn/sr.ht-dev
This diff adds support for Github-style checkbox items. This will close out
the request at ~sircmpwn/todo.sr.ht#36. The syntax matches the accepted
Github syntax:
[ ] Sample unchecked box.
[x] Sample checked task.
[X] We support this too.
The checkboxes are added using a SpanToken to keep this a small change.
Implementing this type of list as a separate BlockToken is a bigger can of
worms, and I don't think the game is worth the candle. This does also mean
that checkboxes can be added inline to a paragraph.
The checkbox syntax isn't CommonMark compliant, but it is a todo related
to todo.sr.ht, and a common/accepted usage from Github so I figure this
[message trimmed]
From jack gleeson to ~sircmpwn/sr.ht-dev
--- This patch adds del to the html sanitize whitelist, allowing strikethroughs. srht/markdown.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/srht/markdown.py b/srht/markdown.py index 5005542..4b8431b 100644 --- a/srht/markdown.py +++ b/srht/markdown.py @@ -12,7 +12,7 @@ import mistletoe as m from mistletoe.span_token import SpanToken, RawText import re [message trimmed]
From jack gleeson to ~sircmpwn/sr.ht-dev
--- This patch adds del to the html sanitize whitelist, allowing strikethroughs. srht/markdown.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/srht/markdown.py b/srht/markdown.py index 5005542..4b8431b 100644 --- a/srht/markdown.py +++ b/srht/markdown.py @@ -12,7 +12,7 @@ import mistletoe as m from mistletoe.span_token import SpanToken, RawText import re [message trimmed]
From Jack Gleeson to ~sircmpwn/sr.ht-dev
>> I'm not seeing where in this patch it is recognizing the ~~ notation.
That's something built in to the mistletoe library.
It also includes support for tables - also not in CommonMark.
I'm just providing a function to render the existing strikethrough
tokens
as strikethroughs.
From Jack Gleeson to ~sircmpwn/sr.ht-dev
This patch works with the ~~ notation and recognises it as strikethrough. Use of <del> in place of <s> was just personal preference, I'm agnostic on which is more suitable. I didn't realise CommonMark still hadn't agreed on including strikethrough in the specification. I see the value in including them, but recognise that it is not in the standard. In which case, it's fair to call this out of scope and ddevault can ignore this patch.
From jack gleeson to ~sircmpwn/sr.ht-dev
--- This adds back strikethrough support to the markdown renderer. Strikethroughs are rendered as del HTML elements. srht/markdown.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/srht/markdown.py b/srht/markdown.py index 5005542..68eae1d 100644 --- a/srht/markdown.py +++ b/srht/markdown.py @@ -12,7 +12,7 @@ import mistletoe as m from mistletoe.span_token import SpanToken, RawText import re [message trimmed]
From to ~sircmpwn/gmni-discuss
> Does your client support TOFU properly? We use a self-signed cert.
Almost certainly not, first time trying to implement something like this.
Going to dig back in and try figure it out. Still confuses me why it
works the first time around though.
Cheers,
Jack