zulip/web/third/marked/lib
Alex Vandiver 753082fd05 markdown: Use RE2JS for linkifier rendering.
The client previously translated linkifier regexes to native
JavaScript RegExp via `python_to_js_linkifier`, which could not
preserve re2 semantics: named groups had to be rewritten, Perl flags
were silently stripped, and the trailing word-boundary used JS `\w`
(which includes `_`) instead of the server's `[^\pL\pN]`.
`contains_problematic_linkifier` had to fall back to server-side
rendering whenever a pattern might match differently on the client.

re2js is a JavaScript port of the same re2 engine the server uses,
allowing the client to execute user patterns directly without
translation.  This lets us delete the regex translator and the
`contains_problematic_linkifier` fallback, align the client's
boundary handling with the server, expand local echo to cover
linkifier matches that previously required a server round trip, and
extend RE2's linear-time matching guarantee to user-supplied regexes
on the client, eliminating linkifier-driven ReDoS exposure.
2026-05-19 21:50:56 -07:00
..
marked.cjs markdown: Use RE2JS for linkifier rendering. 2026-05-19 21:50:56 -07:00
marked.d.cts markdown: Use RE2JS for linkifier rendering. 2026-05-19 21:50:56 -07:00