-
Notifications
You must be signed in to change notification settings - Fork 510
Add auto-linker for patterns in notes #5998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
A cool feature (but probably more nice-to-have) would be a "test area" below the management UI where you can write markdown or HTML and see the output :) |
5448e46 to
1d3e449
Compare
Will you believe I did think of that? I kind of dismissed it as "nice to have", but maybe it's actually not that hard to do it, at least as far as Markdown is concerned. I'll see what I can do. |
1d3e449 to
2cb483f
Compare
a73b957 to
78d7153
Compare
158cdcf to
6b395ba
Compare
251c4d0 to
1cb2363
Compare
indico/modules/events/client/js/components/AutoLinkerConfig.jsx
Outdated
Show resolved
Hide resolved
indico/modules/events/client/js/components/AutoLinkerConfig.jsx
Outdated
Show resolved
Hide resolved
1cb2363 to
ce379c3
Compare
| <List divided relaxed> | ||
| {rules.map(({regex, url}, n) => { | ||
| const encodedURI = encodeURIComponent(url.replace(/\{(\d+)\}/g, '\\$1')); | ||
| const encodedRegex = encodeURIComponent(regex.replace(/"/g, '\\"')); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding
ce379c3 to
9eb93e7
Compare

This implements a long-awaited (at least by me!) feature, which automatically adds links around specific text patterns. It works for notes, both in markdown (w/ preview) and TinyMCE (no preview, unfortunately).
The only problem I noticed so far is that if we use a super-generic regex, e.g.
(\d+), the markdown parser gets stuck in an infinite loop. I'm convinced this is probably a bug in themarkdownpackage, but given this is an admin-only feature, I reckon the risk of abuse/accidents is minimal.