Skip to content

Commit 46b1e5e

Browse files
committed
feat(website): list authors on website
1 parent 40d0e00 commit 46b1e5e

File tree

4 files changed

+98
-10
lines changed

4 files changed

+98
-10
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!---{
2+
"title": "quick-lint-js authors",
3+
"navTitle": "Authors"
4+
}--->
5+
6+
<!DOCTYPE html>
7+
<!-- Copyright (C) 2020 Matthew "strager" Glazar -->
8+
<!-- See end of file for extended copyright information. -->
9+
<html>
10+
<head>
11+
<%- await include("../../common-head.ejs.html") %>
12+
<link href="../../main.css" rel="stylesheet" />
13+
</head>
14+
<body class="side-bar-nav">
15+
<header><%- await include("../../common-nav.ejs.html") %></header>
16+
17+
<script>
18+
//<%
19+
let fs = await import("node:fs");
20+
let { default: MarkdownIt } = await import("markdown-it");
21+
let { retagHeadings } = await importFileAsync("../../../src/markdown.mjs");
22+
23+
let authorsMarkdown = await fs.promises.readFile(absoluteFilePath("../../../../docs/AUTHORS.md"), "utf-8");
24+
25+
let env = {};
26+
let markdownParser = new MarkdownIt("commonmark");
27+
let tokens = markdownParser.parse(authorsMarkdown, env);
28+
tokens = retagHeadings(tokens, {
29+
h1: "h2",
30+
h2: "h3",
31+
h3: "h4",
32+
h4: "h5",
33+
});
34+
let html = markdownParser.renderer.render(tokens, markdownParser.options, env);
35+
//%>
36+
</script>
37+
38+
<main><%- html %></main>
39+
40+
<footer><%- await include("../../common-footer-nav.ejs.html") %></footer>
41+
</body>
42+
</html>
43+
44+
<!--
45+
quick-lint-js finds bugs in JavaScript programs.
46+
Copyright (C) 2020 Matthew "strager" Glazar
47+
48+
This file is part of quick-lint-js.
49+
50+
quick-lint-js is free software: you can redistribute it and/or modify
51+
it under the terms of the GNU General Public License as published by
52+
the Free Software Foundation, either version 3 of the License, or
53+
(at your option) any later version.
54+
55+
quick-lint-js is distributed in the hope that it will be useful,
56+
but WITHOUT ANY WARRANTY; without even the implied warranty of
57+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58+
GNU General Public License for more details.
59+
60+
You should have received a copy of the GNU General Public License
61+
along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>.
62+
-->

website/public/contribute/index.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export async function loadNavSubpagesAsync() {
1616
"create-diagnostic",
1717
"coding-standards",
1818
"submit",
19+
"authors",
1920
];
2021
return [].concat(
2122
...(await Promise.all(

website/src/markdown.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (C) 2020 Matthew "strager" Glazar
2+
// See end of file for extended copyright information.
3+
4+
export function retagHeadings(markdownTokens, tagChanges) {
5+
return markdownTokens.map((token) => {
6+
if (
7+
(token.type === "heading_open" || token.type === "heading_close") &&
8+
tagChanges.hasOwnProperty(token.tag)
9+
) {
10+
return { ...token, tag: tagChanges[token.tag] };
11+
} else {
12+
return token;
13+
}
14+
});
15+
}
16+
17+
// quick-lint-js finds bugs in JavaScript programs.
18+
// Copyright (C) 2020 Matthew "strager" Glazar
19+
//
20+
// This file is part of quick-lint-js.
21+
//
22+
// quick-lint-js is free software: you can redistribute it and/or modify
23+
// it under the terms of the GNU General Public License as published by
24+
// the Free Software Foundation, either version 3 of the License, or
25+
// (at your option) any later version.
26+
//
27+
// quick-lint-js is distributed in the hope that it will be useful,
28+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
29+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30+
// GNU General Public License for more details.
31+
//
32+
// You should have received a copy of the GNU General Public License
33+
// along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>.

website/src/release-documentation.mjs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import MarkdownIt from "markdown-it";
55
import assert from "node:assert";
6+
import { retagHeadings } from "./markdown.mjs";
67

78
let markdownParser = new MarkdownIt("commonmark");
89

@@ -62,16 +63,7 @@ function demoteHeadings(markdownTokens) {
6263
h3: "h4",
6364
h4: "h5",
6465
};
65-
return markdownTokens.map((token) => {
66-
if (
67-
(token.type === "heading_open" || token.type === "heading_close") &&
68-
demotions.hasOwnProperty(token.tag)
69-
) {
70-
return { ...token, tag: demotions[token.tag] };
71-
} else {
72-
return token;
73-
}
74-
});
66+
return retagHeadings(markdownTokens, demotions);
7567
}
7668

7769
// @returns Array<[number, number]>

0 commit comments

Comments
 (0)