Skip to content

Commit 903617b

Browse files
committed
Marketplace Markdown UI: Try to fix relative links to files inside Plugin repos.
1 parent 6eb2267 commit 903617b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

htdocs/js/pages/admin/Marketplace.class.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
515515
// fix all local hash links to point back to remote repo
516516
var args = this.args;
517517
var anchor = args.anchor || '';
518+
var repo_base_url = this.product.repo_url || `https://github.com/${this.product.id}`;
518519

519520
if (!elem) elem = this.div;
520521
else if (typeof(elem) == 'string') elem = $(elem);
@@ -533,6 +534,9 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
533534
if (href.match(/^\#/)) {
534535
$this.attr({ 'href': '#' + Nav.loc + '/' + href.replace(/\#/, '') });
535536
}
537+
else if (href.match(/^[\w\-\.]+$/)) {
538+
$this.attr({ 'href': repo_base_url + '/blob/main/' + href });
539+
}
536540
} );
537541
}
538542

0 commit comments

Comments
 (0)