Skip to content

Commit d047b0a

Browse files
committed
Add placeholder content to showcase usage of app
1 parent 6c5080e commit d047b0a

3 files changed

Lines changed: 46 additions & 1 deletion

File tree

docs/getting-started.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!-- Simple getting started guide -- Used as a placeholder page -->
2+
3+
Compare GitHub release notes. Supports URL parameters for direct linking to comparisons.
4+
5+
**Available Parameters**
6+
7+
- `repo` - GitHub Repository in `owner/name` format
8+
- `from` - Starting release tag
9+
- `to` - Ending release tag
10+
- `prereleases` - Include Pre-releases (`true` or `false`)
11+
12+
**Notes**
13+
14+
- All three main parameters (`repo`, `from` and `to`) are required for the comparison to work.
15+
- Make sure to [URL encode](https://en.wikipedia.org/wiki/Percent-encoding) special characters in parameter values if needed
16+
17+
**Examples**
18+
19+
Basic comparison
20+
21+
<https://example.com/?repo=picocss/pico&from=v1.5.10&to=v2.0.0>
22+
23+
Basic comparison including Pre-release
24+
25+
<https://example.com/?repo=picocss/pico&from=v1.5.10&to=v2.0.0&prereleases=true>

src/modules/github-compare.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
releaseArticle,
77
alertArticle,
88
compareHeader,
9+
placeholderArticle,
910
} from "./html-templates.mjs";
1011

1112
const octokit = new Octokit({});
@@ -28,6 +29,7 @@ function init(settings_ = {}) {
2829
Object.assign(settings, settings_);
2930
setupEventListeners();
3031
initUrlSearchParams();
32+
results.innerHTML = placeholderArticle();
3133
}
3234

3335
function updateUrl() {

src/modules/html-templates.mjs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import emojis from "./emojis.mjs";
22
import { markdownParse } from "./markdown.mjs";
33
import "@github/relative-time-element";
4+
import placeholderMarkdown from "./../../docs/getting-started.md?raw";
45

56
function compareHeader({ releases, from, to, repo }) {
67
const header = `
@@ -92,4 +93,21 @@ function alertArticle(content, level = "info") {
9293
return article;
9394
}
9495

95-
export { releaseArticle, alertArticle, compareHeader };
96+
function placeholderArticle() {
97+
const body = markdownParse(placeholderMarkdown);
98+
99+
// Make sure to use links relevant to this page
100+
body.replaceAll(
101+
"https://example.com/",
102+
window.location.origin + window.location.pathname
103+
);
104+
105+
const article = `
106+
<article>
107+
${body}
108+
</article>
109+
`;
110+
return article;
111+
}
112+
113+
export { releaseArticle, alertArticle, compareHeader, placeholderArticle };

0 commit comments

Comments
 (0)