Obsidian-Code-Styler icon indicating copy to clipboard operation
Obsidian-Code-Styler copied to clipboard

Feature Request: Support self-hosted repositories in reference blocks

Open phxyz12 opened this issue 9 months ago • 0 comments

Summary

Please add support for self-hosted repositories that are available under URLs not ending with .com

Basic example

Referencing a file in a e. g. Gitlab repository currently is only supported, when the FQDN part in the URL ends on .com. Referencing a file like e.g.:

https://gl.net.home/pascal/home-it/-/blob/main/Services/manager_main_config.xml

would lead to this error:

No such repository could be found

The cause of this is in main.js, here is the relevant snippet:

function idExternalReference(fileLink) {
  const linkInfo = /^https?:\/\/(.+)\.com\/(.+)$/.exec(fileLink);
  if (!(linkInfo == null ? void 0 : linkInfo[1]) || !(linkInfo == null ? void 0 : linkInfo[2]))
    throw Error("No such repository could be found");
  return { id: [linkInfo[1], ...linkInfo[2].split("/")].join("-"), website: linkInfo[1] };
}

The linkInfo = part hard codes .com which makes using other TLD impossible.

Motivation

It would be great to be able to use this reference feature in conjunction with self-hosted, local repositories

Existing Requests?

None found.

phxyz12 avatar Mar 20 '25 16:03 phxyz12