Skip to content

Conversation

MaralWa
Copy link

@MaralWa MaralWa commented Jul 28, 2025

Configuration for additional URL patterns

The pull requests adds the possibility to configure additional URL patterns that can be handled by the user defined function follow_url_func:

      -- Optional, URL patterns that can be handled by function `follow_img_func`
      url_patterns = {
	-- an arbitrary number of patterns can be provided
        url_patterns = {
          {
	    -- example for an UUID like patttern, allows to open links like
	    --   [UUID markdown](uuid://abcdef-1234-5678-90af-abcdef)
	    --   [[uuid://abcdef-1234-5678-90af-abcdef|UUID wikki]]
            name = "URL-UUID",
            pattern = "uuid://[0-9a-fA-F]+%-[0-9a-fA-F]+%-[0-9a-fA-F]+%-[0-9a-fA-F]+%-[0-9a-fA-F]+",
          },
          {
	    -- example for an app specific patttern, allows to open links like
	    --   [App markdown](app:///data/testData)
	    --   [[app:///data/testData|App wikki]]
            name = "App",
            pattern = "app:///data/[a-zA-Z]+",
          },
      },

The patterns are check in obsidian.util.is_url.

Sarah@Jadzia and others added 5 commits July 28, 2025 13:56
…uses defined functions `follow_url_func`

The configuration looks like this

    url_patterns = {
      { name = "Name_1", pattern = "pattern_1" },
      { name = "Name_n", pattern = "pattern_n" }
    },
- type obsidian.search.UrlPatternSpec moved to obsidian.config
- added change to CHANGELOG.md
@neo451
Copy link
Member

neo451 commented Jul 31, 2025

looks nice, will give it more looks once I have time, but what's up with url_patterns field inside the url_pattern?

@MaralWa
Copy link
Author

MaralWa commented Aug 3, 2025

The inner url_patterns field in the documentation is an error. I commited a fix.

customizations = {},
},

-- Optional, URL patterns that can be handled by function `follow_img_func`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow_url_func

@neo451
Copy link
Member

neo451 commented Aug 6, 2025

@MaralWa

Some suggestions:

  1. I think you can make a new config module links (reference backlinks), and have field url_patterns. so that related features can be grouped under it in the future.
  2. I personally prefer just a list of pattern strings, because you are not really using the name field in the code, and having a specific shape is friction.

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