Skip to content

Commit 20b1e1f

Browse files
Add sources links and adjust link hover feedback
1 parent 72ea324 commit 20b1e1f

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

docs/css/docs.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ aside .module-name:hover,
190190
}
191191

192192
.breadcrumbs > a:hover {
193-
color: black;
193+
color: #0275d8;
194+
text-decoration: underline;
194195
}
195196

196197
.breadcrumbs > span {
@@ -255,9 +256,20 @@ footer {
255256

256257
footer a,
257258
footer a:visited {
258-
color: #3377c0;
259+
color: #0275d8;
259260
}
260261

261262
footer a:hover {
262-
color: #2f6cb6;
263+
color: #0275d8;
264+
text-decoration: underline;
265+
}
266+
267+
.meta a,
268+
.meta a:visited {
269+
color: #0275d8;
270+
}
271+
272+
.meta a:hover {
273+
color: #0275d8;
274+
text-decoration: underline;
263275
}

docs/templates/function.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,26 @@ const nameFragment = (name, pathParts) =>
3737
)}<span>/</span><a href="${getPath(pathParts, name)}">${name}</a></h3>`
3838
: "";
3939

40+
const blobUrl = "https://github.com/sandstreamdev/std/blob/master";
41+
42+
const sourcePath = (name, partPaths, extension) =>
43+
`${[blobUrl, partPaths, name].join("/")}${extension}`;
44+
45+
const metaFragment = (name, pathParts) =>
46+
name
47+
? `<p class="meta">
48+
<a href="${sourcePath(
49+
name,
50+
pathParts,
51+
".ts"
52+
)}">TypeScript source</a> • <a href="${sourcePath(
53+
name,
54+
pathParts,
55+
".js"
56+
)}">JavaScript source</a>
57+
</p>`
58+
: "";
59+
4060
const descriptionFragment = description => {
4161
if (!description || description.startsWith("TODO")) {
4262
return "";
@@ -115,6 +135,7 @@ const funcTemplate = (
115135
${signatureFragment(signature)}
116136
${examplesFragment(examples, pathParts, name)}
117137
${questionsFragment(questions)}
138+
${metaFragment(name, pathParts)}
118139
</article>`.trimLeft();
119140

120141
return content;

0 commit comments

Comments
 (0)