Skip to content
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

Allow word boundary regex to be customized for unlinked reference #2359

Closed

Conversation

okomestudio
Copy link

Motivation for this change

The unlinked references are searched for by ripgrep using a simple regex pattern (\b%s\b). This works fine with English, but in a language for which the concept of regex word boundary doesn't apply (e.g., CJK), the pattern doesn't work. The issue #1290 for Chinese is an example.

This PR introduces org-roam-unlinked-references-word-boundary-re custom variable so that users can modify the regex pattern used by ripgrep.

For example, adding a pattern like this

(set-q org-roam-unlinked-references-word-boundary-re
       "|(\\b%1$s\\b|(?<=[^\x20-\x7e\xff61-\xff9f])%1$s(?=[^\x20-\x7e\xff61-\xff9f]))")

the regex would work sufficiently well in both English and Japanese.

This PR should fix #1290, though improving regex pattern is delegated to users.

@okomestudio
Copy link
Author

To avoid clutter, closing this PR in favor of #2416.

@okomestudio okomestudio closed this Feb 4, 2024
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.

org-roam-unlinked-references doesn't work for Chinese sentence
1 participant