From 29f7369da363a8508ab807fc4189c0d8ad01d971 Mon Sep 17 00:00:00 2001 From: Deimos Date: Wed, 17 Oct 2018 23:03:07 -0600 Subject: [PATCH] Update cmark-gfm to 0.28.3.gfm.19 Of course right after I did that last update, they released two more new versions of cmark-gfm, so here we go again. The .18 update defaults to "safe" mode, but I want to disable that and leave sanitization up to Bleach, so this required changing the options. --- salt/salt/cmark-gfm.sls | 4 ++-- tildes/tildes/lib/cmark.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/salt/salt/cmark-gfm.sls b/salt/salt/cmark-gfm.sls index df7a794..efd7276 100644 --- a/salt/salt/cmark-gfm.sls +++ b/salt/salt/cmark-gfm.sls @@ -3,8 +3,8 @@ unpack-cmark-gfm: - name: /tmp/cmark-gfm - source: - salt://cmark-gfm.tar.gz - - https://github.com/github/cmark-gfm/archive/0.28.3.gfm.17.tar.gz - - source_hash: sha256=101ccfcd4f0fd8b05c20994006d992f2e81d6f96655afee4c66742ccc21f1f7d + - https://github.com/github/cmark-gfm/archive/0.28.3.gfm.19.tar.gz + - source_hash: sha256=d2c8cb255e227d07533a32cfd4a052e189f697e2a9681d8b17d15654259e2e4b - if_missing: /usr/local/lib/libcmark-gfm.so - options: --strip-components=1 - enforce_toplevel: False diff --git a/tildes/tildes/lib/cmark.py b/tildes/tildes/lib/cmark.py index 6180068..249a796 100644 --- a/tildes/tildes/lib/cmark.py +++ b/tildes/tildes/lib/cmark.py @@ -7,9 +7,11 @@ from ctypes import CDLL, c_char_p, c_int, c_size_t, c_void_p CMARK_DLL = CDLL("/usr/local/lib/libcmark-gfm.so") CMARK_EXT_DLL = CDLL("/usr/local/lib/libcmark-gfm-extensions.so") -# enables the --hardbreaks option for cmark -# (can I import this? it's defined in cmark.h as CMARK_OPT_HARDBREAKS) -CMARK_OPTS = 4 +# Enable the --hardbreaks and --unsafe options for cmark +# Can we import these somehow? They're defined in cmark.h as: +# CMARK_OPT_HARDBREAKS (1 << 2) +# CMARK_OPT_UNSAFE (1 << 17) +CMARK_OPTS = (1 << 2) | (1 << 17) CMARK_EXTENSIONS = (b"strikethrough", b"table")