-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathopen-people.astro
More file actions
71 lines (61 loc) · 1.52 KB
/
open-people.astro
File metadata and controls
71 lines (61 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
import PageLayout from "../layouts/page.astro";
import { marked } from "marked";
import { border } from "../styles/shared.js";
const response = await fetch(
"https://raw.githubusercontent.com/guardian/our-engineering-culture/main/README.md",
);
const markdown = await response.text();
const content = marked.parse(markdown);
---
<PageLayout title="Open People" edit="open-people.astro">
<section id="people">
<h1>Open People</h1>
<p>
As defined in our <a
href="https://github.com/guardian/our-engineering-culture"
>engineering culture</a
>, the key pillars are:
</p>
<ul>
<!-- Extract titles from markdown for linking to sections directly -->
{
content
.split("\n")
.filter((line) => line.startsWith("#### "))
.map((pillar) => {
const name = pillar.slice(5);
const link = name
.trim()
.replaceAll("&", "")
.replaceAll(" ", "-")
.toLowerCase();
return (
<li>
<a href={`#${link}`}>{name}</a>
</li>
);
})
}
</ul>
<hr />
<article set:html={content} />
</section>
</PageLayout>
<style lang="scss" define:vars={{ border }}>
section {
padding: 0 1rem;
// All but the first section
&:nth-of-type(n + 2) {
border-top: var(--border);
}
p,
ul {
max-width: 36rem;
}
}
hr {
border: none;
border-top: var(--border);
}
</style>