Skip to content

Commit

Permalink
frontend: fix github images on master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenVoich committed Oct 17, 2024
1 parent c81e0cd commit c435fa2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 2 additions & 4 deletions blog/blog/0-unlisted.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Run `mops self update` to update Mops CLI to the latest version.
- Fixed mops failing when dfx is not installed
- Fixed `mops test` Github Action template

## More information of package dependencies and dependents
## Fix GitHub images in package readme

On the package page, in the "Dependencies" tab, you can see how old is a dependency and the latest available version of the dependency.

In the "Dependents" tab, you can see which version of a package a dependent package uses.
Now images in the package readme are displayed correctly when main branch is `master` instead of `main`.
5 changes: 3 additions & 2 deletions frontend/logic/markdown-to-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ export let markdownToHtml = async (markdown : string, repositoryUrl ?: string) =
let relToAbs = (url : string) => {
if (url && !url.startsWith('http') && !url.startsWith('#')) {
let sep = url.startsWith('/') ? '' : '/';
// todo: master branch?
return repositoryUrl + sep + 'raw/main/' + url;
let urlObj = new URL(repositoryUrl);
urlObj.host = 'raw.githubusercontent.com';
return urlObj.toString() + sep + 'master/' + url;
}
return url;
};
Expand Down

0 comments on commit c435fa2

Please sign in to comment.