~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH v2] Add strikethrough support to SrhtRenderer

Details
Message ID
<20220722180406.6556-1-jack@jpgleeson.com>
DKIM signature
missing
Download raw message
Patch: +2 -1
---
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

SRHT_MARKDOWN_VERSION = 14
SRHT_MARKDOWN_VERSION = 15

class PlainLink(SpanToken):
    """
@@ -182,6 +182,7 @@ _sanitizer = bleach.sanitizer.Cleaner(
        "h1", "h2", "h3", "h4", "h5", "h6",
        "details", "summary",
        "abbr", "dfn",
        "del",
    ],
    attributes={**bleach.sanitizer.ALLOWED_ATTRIBUTES, **_sanitizer_attrs},
    protocols=[
-- 
2.36.1
Details
Message ID
<94abad03-56d1-a467-c058-c1b4c3d0c1cc@c9yh.net>
In-Reply-To
<20220722180406.6556-1-jack@jpgleeson.com> (view parent)
DKIM signature
missing
Download raw message
On 7/22/2022 1:04 PM, jack gleeson wrote:

> ---
> 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
>   
> -SRHT_MARKDOWN_VERSION = 14
> +SRHT_MARKDOWN_VERSION = 15
>   
>   class PlainLink(SpanToken):
>       """
> @@ -182,6 +182,7 @@ _sanitizer = bleach.sanitizer.Cleaner(
>           "h1", "h2", "h3", "h4", "h5", "h6",
>           "details", "summary",
>           "abbr", "dfn",
> +        "del",
>       ],
>       attributes={**bleach.sanitizer.ALLOWED_ATTRIBUTES, **_sanitizer_attrs},
>       protocols=[


LGTM. Here's to hoping CommonMark and Mistletoe get a better solution 
eventually.
Reply to thread Export thread (mbox)