Skip to content

Conversation

@hlfan
Copy link
Collaborator

@hlfan hlfan commented Dec 11, 2025

Fixes the Rinku-independent part of #6611

@hlfan hlfan force-pushed the markdowned-link-ignoring branch from 96f5416 to 5024391 Compare December 11, 2025 13:52
@hlfan hlfan changed the title Ignore backticks for wiki linkification Scope wiki linkification characters loosely around wiki_pages.yml Dec 11, 2025
@hlfan hlfan force-pushed the markdowned-link-ignoring branch 2 times, most recently from 833a6d7 to 38f0d98 Compare December 11, 2025 14:11
@pablobm
Copy link
Contributor

pablobm commented Dec 11, 2025

Hm, I wish we tested those too. I understand we present them as a configuration detail, but as they get more complex their logic is going to be forgotten.

@tomhughes
Copy link
Member

There's no reason we can't test the behaviour of the default though?

We do have a load of tests in test/lib/rich_text.rb though most of them override the actual linkification rules though I don't really know why as testing with the default seems at least as useful and probably more so.

@pablobm
Copy link
Contributor

pablobm commented Dec 15, 2025

Haven't tried, but by looking at the code I think if we don't call with_settings (the test helper) then the defaults will apply, making them testable 👍

@hlfan
Copy link
Collaborator Author

hlfan commented Dec 16, 2025

The default test settings are a bit different from the default settings:

with_settings(:server_url => "www.openstreetmap.org", :server_protocol => "https") do

That's what I needed to override to paste in the cases from #5780.

@hlfan hlfan force-pushed the markdowned-link-ignoring branch 2 times, most recently from bfcd0cb to e9953e9 Compare December 17, 2025 23:45
@hlfan hlfan changed the title Scope wiki linkification characters loosely around wiki_pages.yml Improve linkification scoping Dec 17, 2025
@pablobm
Copy link
Contributor

pablobm commented Dec 18, 2025

@hlfan - I think we shouldn't try to fix #6616 (mentions with spaces) with a regexp or similar. I think we should implement a selector of the sort you see in GitHub or Slack, where you get a dropdown the moment you enter an "@" character, and then this gets stored as @[user_id:$USER_ID] (or something to that effect) that is interpreted and replaced as appropriate when renderding. This would also fix the issue of users changing usernames and leaving old usernames behind in comments, sometimes maliciously.

@gravitystorm

This comment was marked as off-topic.

@hlfan
Copy link
Collaborator Author

hlfan commented Dec 18, 2025

Do you wanna make a separate issue for the user dropdown?

@tomhughes

This comment was marked as off-topic.

@hlfan hlfan force-pushed the markdowned-link-ignoring branch from e9953e9 to 07c068d Compare December 18, 2025 15:20
@pablobm
Copy link
Contributor

pablobm commented Dec 18, 2025

Do you wanna make a separate issue for the user dropdown?

Probably best, yes. Thank you.

@hlfan hlfan force-pushed the markdowned-link-ignoring branch from 07c068d to 9d20489 Compare December 18, 2025 15:59
@hlfan hlfan requested a review from pablobm December 18, 2025 16:00
@hlfan hlfan force-pushed the markdowned-link-ignoring branch from 9d20489 to b592e32 Compare December 18, 2025 17:30
@hlfan hlfan changed the title Improve linkification scoping Scope wiki linkification characters using POSIX words Dec 18, 2025
@hlfan
Copy link
Collaborator Author

hlfan commented Dec 18, 2025

@tomhughes \p{Word} is causing timeouts... is there a more performant option?

@pablobm
Copy link
Contributor

pablobm commented Dec 19, 2025

Not sure it's enough for a timeout, but I can confirm that in the key=value patterns, the \p{Word} ones are running about 10x slower than similar \w ones (just as a comparison, I know they are not the same). These are some numbers, taken from running test/models/diary_entry_test.rb in my computer:

 11us /(?<=^|[^\w!#$%&'*+,.\/:;=?@_~^\-])(?<key>[-+,.:;'%()\w]+)=(?<value>[-+,.:;'%()\/\w]+)/i
116us /(?<=^|[^\w!#$%&'*+,.\/:;=?@_~^\-])(?<key>[-+,.:;'%()\p{Word}]+)=(?<value>[-+,.:;'%()\/\p{Word}]+)/i

 11us /(?<=^|[^\w!#$%&'*+,.\/:;=?@_~^\-])(?<key>[-+,.:;'%()\w]+)=(?<value>[-+,.:;'%()\/\w]+)/i
116us /(?<=^|[^\w!#$%&'*+,.\/:;=?@_~^\-])(?<key>[-+,.:;'%()\p{Word}]+)=(?<value>[-+,.:;'%()\/\p{Word}]+)/i

 24us /(?<=^|[^\w!#$%&'*+,.\/:;=?@_~^\-])(?<key>[-+,.:;'%()\w]+)=(?<value>[-+,.:;'%()\/\w]+)/i
236us /(?<=^|[^\w!#$%&'*+,.\/:;=?@_~^\-])(?<key>[-+,.:;'%()\p{Word}]+)=(?<value>[-+,.:;'%()\/\p{Word}]+)/i

 32us /(?<=^|[^\w!#$%&'*+,.\/:;=?@_~^\-])(?<key>[-+,.:;'%()\w]+)=(?<value>[-+,.:;'%()\/\w]+)/i
302us /(?<=^|[^\w!#$%&'*+,.\/:;=?@_~^\-])(?<key>[-+,.:;'%()\p{Word}]+)=(?<value>[-+,.:;'%()\/\p{Word}]+)/i

@pablobm
Copy link
Contributor

pablobm commented Dec 19, 2025

Do you wanna make a separate issue for the user dropdown?

@hlfan - Sorry, for a moment I thought you were saying you were going to create the issue yourself. Now I re-read the comment and realised you hadn't. Done now! #6635

@tomhughes
Copy link
Member

The default timeout is 1s which seems a world away from the times @pablobm is reporting unless the github actions runners are really slow...

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.

4 participants