astro-accelerator 0.0.74 → 0.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/public/css/main.css +25 -0
- package/public/js/main.js +5 -0
- package/public/js/modules/headers.js +21 -0
- package/src/config.ts +1 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.76",
|
|
3
3
|
"author": "Steve Fenton",
|
|
4
4
|
"name": "astro-accelerator",
|
|
5
5
|
"description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@astrojs/mdx": "^0.18.2",
|
|
28
28
|
"astro": "^2.1.7",
|
|
29
|
-
"astro-accelerator-utils": "^0.2.
|
|
29
|
+
"astro-accelerator-utils": "^0.2.24",
|
|
30
30
|
"hast-util-from-selector": "^2.0.1",
|
|
31
31
|
"remark-directive": "^2.0.1",
|
|
32
32
|
"sharp": "^0.31.3"
|
package/public/css/main.css
CHANGED
|
@@ -892,6 +892,31 @@ pre.astro-code code {
|
|
|
892
892
|
transform: rotate(4deg);
|
|
893
893
|
}
|
|
894
894
|
|
|
895
|
+
.bookmark-link {
|
|
896
|
+
margin-inline-start: 0.2em;
|
|
897
|
+
border-radius: var(--block-radius);
|
|
898
|
+
font-size: 0.5em;
|
|
899
|
+
text-decoration: none;
|
|
900
|
+
position: relative;
|
|
901
|
+
top: -0.5em;
|
|
902
|
+
color: var(--fore-link);
|
|
903
|
+
float: right;
|
|
904
|
+
overflow: hidden;
|
|
905
|
+
display: block;
|
|
906
|
+
width: 1.2em;
|
|
907
|
+
height: 1.5em;
|
|
908
|
+
opacity: 0.5;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
.bookmark-link::before {
|
|
912
|
+
content: '🔗 ';
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
.bookmark-link:hover,
|
|
916
|
+
.bookmark-link:focus {
|
|
917
|
+
background-color: unset;
|
|
918
|
+
opacity: 1;
|
|
919
|
+
}
|
|
895
920
|
|
|
896
921
|
.magnify-container {
|
|
897
922
|
max-height: 0px;
|
package/public/js/main.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { qsa } from './query.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enables copy on code blocks (<pre><code>...)
|
|
5
|
+
*/
|
|
6
|
+
function enhanceHeaders() {
|
|
7
|
+
|
|
8
|
+
// Make code blocks focusable, so they can be keyboard scrolled
|
|
9
|
+
qsa('h2[id], h3[id], h4[id], h5[id], h6[id]').forEach((elem) => {
|
|
10
|
+
const linkContainer = document.createElement('a');
|
|
11
|
+
linkContainer.href = `#${elem.id}`;
|
|
12
|
+
linkContainer.className = 'bookmark-link';
|
|
13
|
+
linkContainer.innerHTML = 'Bookmark'
|
|
14
|
+
console.log(elem, typeof elem);
|
|
15
|
+
elem.appendChild(linkContainer);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { enhanceHeaders }
|