Skip to content

Conversation

@pferreir
Copy link
Member

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 the markdown package, but given this is an admin-only feature, I reckon the risk of abuse/accidents is minimal.

image image

@ThiefMaster
Copy link
Member

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 :)

@pferreir
Copy link
Member Author

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 :)

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.

@pferreir
Copy link
Member Author

Added a "test-drive" component:

image

@pferreir pferreir force-pushed the add-autolinker branch 4 times, most recently from a73b957 to 78d7153 Compare October 26, 2023 09:23
@pferreir pferreir force-pushed the add-autolinker branch 2 times, most recently from 251c4d0 to 1cb2363 Compare October 31, 2023 11:27
<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

This does not escape backslash characters in the input.
@ThiefMaster ThiefMaster added this to the v3.3 milestone Nov 1, 2023
@ThiefMaster ThiefMaster merged commit ec56cf0 into indico:master Nov 1, 2023
@ThiefMaster ThiefMaster deleted the add-autolinker branch November 1, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants