Skip to content

Commit 06cbbdd

Browse files
committed
Add an edit link, revise footer style
1 parent 5234214 commit 06cbbdd

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

docs/layout.html

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ <h1><img src="logo.svg">Mithril <span class="version">v[version]</span></h1>
2424
</section>
2525
</header>
2626
<main>
27-
<section>
27+
<div class="body">
2828
[body]
29-
<hr />
30-
<small>License: MIT. &copy; Mithril Contributors.</small>
31-
</section>
29+
<div class="footer">
30+
<div>License: MIT. &copy; Mithril Contributors.</div>
31+
<div><a href="https://github.com/MithrilJS/docs/edit/main/[editPath]">Edit</a></div>
32+
</div>
33+
</div>
3234
</main>
3335
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/prism.min.js"></script>
3436
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-jsx.min.js"></script>

docs/style.css

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ header section {position:absolute;width:250px;}
55
nav a {border-left:1px solid #ddd;padding:0 10px;}
66
nav a:first-child {border:0;padding-left:0;}
77
main {margin-bottom:100px;}
8-
main section {margin-left:270px;}
8+
.body {margin-left:270px;}
99
p {margin:0 0 15px;}
1010
pre,code {background:#eee;font-family:monospace;font-size:14px;}
1111
pre {border-left:3px solid #1e5799;overflow:auto;padding:10px 20px;margin:20px 0;}
@@ -45,6 +45,10 @@ h1 + ul li:last-child {border-bottom:0;}
4545
h1 + ul ul {margin:0 0 2px;padding:0 0 0 15px;}
4646
h1 + ul ul li {border:0;}
4747
h1 + ul strong + ul {border-left:3px solid #1e5799;}
48+
.footer {position:relative;border-top:1px solid #ddd;padding:15px 0;margin:15px 0;}
49+
.footer > * {position:absolute;font-size:80%;}
50+
.footer > :first-child {left:0;}
51+
.footer > :last-child {right:0;}
4852

4953
.hamburger {display:none;}
5054

@@ -65,7 +69,7 @@ h1 + ul strong + ul {border-left:3px solid #1e5799;}
6569
@media (max-width: 767px) {
6670
.hamburger {display:block;font-size:30px;padding:0 10px;position:fixed;right:0;top:0;z-index:2;}
6771
.hamburger:hover {text-decoration:none;}
68-
main section {margin:0;}
72+
.body {margin:0;}
6973
header section {margin:0 0 20px;position:static;width:auto;}
7074
h1 + ul {background:#eee;border:1px solid #ccc;box-sizing:border-box;display:none;height:100%;margin:0;overflow:auto;padding:20px;position:fixed;right:0;top:0;width:100%;z-index:1}
7175
h1 + ul + hr {display:block;}
@@ -96,7 +100,7 @@ h1 + ul strong + ul {border-left:3px solid #1e5799;}
96100
}
97101
@media print {
98102
nav,h1 + ul {display:none;}
99-
main section {margin:0;}
103+
.body {margin:0;}
100104
}
101105

102106
/* prism theming */

scripts/_build/generator.js

+4
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export async function makeGenerator() {
8888
])
8989

9090
async function compilePage(file, markdown) {
91+
const filePath = rel(file)
9192
file = path.basename(file)
9293
const fileLink = new RegExp(`([ \t]*)(- )(\\[.+?\\]\\(${escapeRegExp(file)}\\))`)
9394
const src = fileLink.test(guides) ? guides : methods
@@ -179,6 +180,9 @@ export async function makeGenerator() {
179180
}
180181
)
181182

183+
// Insert source file edit path
184+
result = result.replaceAll("[editPath]", filePath)
185+
182186
return result
183187
}
184188

0 commit comments

Comments
 (0)