Skip to content

Commit

Permalink
Refactor "Content From" part
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzdogan committed Jan 3, 2025
1 parent 483737f commit 1726271
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions docs/1. intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ const branch = "master";
const readmePath = "/README.md";
const rawBaseUrl = "https://raw.githubusercontent.com";
const pageBaseUrl = "https://github.com";
export const ReadmeLink = () => (<a href={`${pageBaseUrl}/${repo}/tree/${branch}${readmePath}`}>{repo + readmePath}</a>);

*Content from <ReadmeLink/>*
<EmbedReadme repo={repo} branch={branch} readmePath={readmePath} rawBaseUrl={rawBaseUrl} pageBaseUrl={pageBaseUrl}/>
2 changes: 0 additions & 2 deletions docs/2. Running Sourcify/1-Server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ const branch = "master"
const readmePath = "/services/server/README.md";
const rawBaseUrl = "https://raw.githubusercontent.com";
const pageBaseUrl = "https://github.com";
export const ReadmeLink = () => (<a href={`${pageBaseUrl}/${repo}/tree/${branch}${readmePath}`}>{repo + readmePath}</a>);

*Content from <ReadmeLink/>*
<EmbedReadme repo={repo} branch={branch} readmePath={readmePath} rawBaseUrl={rawBaseUrl} pageBaseUrl={pageBaseUrl}/>
2 changes: 0 additions & 2 deletions docs/2. Running Sourcify/2-UI.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ const branch = "master";
const readmePath = "/README.md";
const rawBaseUrl = "https://raw.githubusercontent.com";
const pageBaseUrl = "https://github.com";
export const ReadmeLink = () => (<a href={`${pageBaseUrl}/${repo}/tree/${branch}${readmePath}`}>{repo + readmePath}</a>);

*Content from <ReadmeLink/>*
<EmbedReadme repo={repo} branch={branch} readmePath={readmePath} rawBaseUrl={rawBaseUrl} pageBaseUrl={pageBaseUrl}/>
2 changes: 0 additions & 2 deletions docs/2. Running Sourcify/3-Monitor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ const branch = "master";
const readmePath = "/services/monitor/README.md";
const rawBaseUrl = "https://raw.githubusercontent.com";
const pageBaseUrl = "https://github.com";
export const ReadmeLink = () => (<a href={`${pageBaseUrl}/${repo}/tree/${branch}${readmePath}`}>{repo + readmePath}</a>);

*Content from <ReadmeLink/>*
<EmbedReadme repo={repo} branch={branch} readmePath={readmePath} rawBaseUrl={rawBaseUrl} pageBaseUrl={pageBaseUrl}/>
13 changes: 10 additions & 3 deletions docs/EmbedReadme.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ export default function EmbedReadme({ repo, branch, readmePath, rawBaseUrl, page
});
}, []);

console.log(rawBaseUrl);

if (!content) return "Loading from " + rawBaseUrl + readmePath + "...";
return <div dangerouslySetInnerHTML={{ __html: content }} />;
return (
<div>
<div>
<i>
Content from <a href={`${pageBaseUrl}/${repo}/tree/${branch}${readmePath}`}>{repo + readmePath}</a>
</i>
</div>
<div dangerouslySetInnerHTML={{ __html: content }} />{" "}
</div>
);
}

0 comments on commit 1726271

Please sign in to comment.