Skip to content

Commit 9d2531f

Browse files
committed
slack: fix unescaping of parentheses
1 parent 9430abd commit 9d2531f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/mrkdwn.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ let escape_mrkdwn =
1111
| '&' -> "&"
1212
| c -> String.make 1 c)
1313

14-
(* omd escapes parentheses in text (bug?) *)
1514
let unescape_omd =
1615
Staged.unstage @@ String.Escaping.unescape_gen_exn ~escapeworthy_map:[ '(', '('; ')', ')' ] ~escape_char:'\\'
1716

18-
let transform_text s = escape_mrkdwn @@ unescape_omd s
17+
let transform_text = escape_mrkdwn
1918

2019
let rec transform_list = List.map ~f:transform
2120

@@ -48,4 +47,5 @@ and transform = function
4847
| Text s -> Text (transform_text s)
4948
| (Code _ | Br | Hr | NL | Ref _ | Img_ref _ | Raw _ | Raw_block _ | X _) as e -> e
5049

51-
let mrkdwn_of_markdown str = to_markdown @@ transform_list @@ of_string str
50+
(* unescaping here is a workaround of to_markdown escaping parentheses in text (bug?) *)
51+
let mrkdwn_of_markdown str = unescape_omd @@ to_markdown @@ transform_list @@ of_string str

0 commit comments

Comments
 (0)