@compiiile/compiiile 2.19.0 → 2.20.0
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/.compiiile/components.d.ts +23 -0
- package/.compiiile/src/components/ContentWrapper.vue +0 -187
- package/.compiiile/src/components/SlidesContent.vue +3 -3
- package/.compiiile/src/pages/[...path].astro +1 -1
- package/.compiiile/src/style/content.css +185 -0
- package/.compiiile/src/style/index.css +1 -0
- package/bin/config.js +14 -28
- package/bin/vitePluginCompiiile/index.js +11 -17
- package/bin/vitePluginCompiiile/markdownConfig.js +28 -20
- package/bin/vitePluginCompiiile/models/Context.js +2 -2
- package/bin/vitePluginCompiiile/rehypeLinkPlugin.js +4 -4
- package/dist/style.css +2 -1
- package/package.json +13 -12
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// Generated by unplugin-vue-components
|
|
4
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
|
5
|
+
export {}
|
|
6
|
+
|
|
7
|
+
/* prettier-ignore */
|
|
8
|
+
declare module 'vue' {
|
|
9
|
+
export interface GlobalComponents {
|
|
10
|
+
ClientScript: typeof import('./src/components/ClientScript.vue')['default']
|
|
11
|
+
ContentWrapper: typeof import('./src/components/ContentWrapper.vue')['default']
|
|
12
|
+
FilesTree: typeof import('./src/components/layout/navBar/FilesTree.vue')['default']
|
|
13
|
+
HamburgerButton: typeof import('./src/components/layout/HamburgerButton.vue')['default']
|
|
14
|
+
NavBar: typeof import('./src/components/layout/navBar/NavBar.vue')['default']
|
|
15
|
+
NavListItem: typeof import('./src/components/layout/navBar/NavListItem.vue')['default']
|
|
16
|
+
SearchBar: typeof import('./src/components/searchBar/SearchBar.vue')['default']
|
|
17
|
+
SearchResult: typeof import('./src/components/searchBar/SearchResult.vue')['default']
|
|
18
|
+
SlidesContent: typeof import('./src/components/SlidesContent.vue')['default']
|
|
19
|
+
TableOfContent: typeof import('./src/components/TableOfContent.vue')['default']
|
|
20
|
+
ThemeSwitcher: typeof import('./src/components/layout/ThemeSwitcher.vue')['default']
|
|
21
|
+
TopBar: typeof import('./src/components/layout/TopBar.vue')['default']
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -119,190 +119,3 @@
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
</script>
|
|
122
|
-
|
|
123
|
-
<style scoped>
|
|
124
|
-
:deep(.markdown-content) {
|
|
125
|
-
margin-right: calc(var(--toc-width) + 80px);
|
|
126
|
-
|
|
127
|
-
h1,
|
|
128
|
-
h2,
|
|
129
|
-
h3,
|
|
130
|
-
h4,
|
|
131
|
-
h5 {
|
|
132
|
-
&:before {
|
|
133
|
-
/* hack to offset scroll on route hash navigation */
|
|
134
|
-
padding-top: calc(var(--top-bar-height) - 1px);
|
|
135
|
-
margin-top: calc((var(--top-bar-height) - 1px) * -1);
|
|
136
|
-
content: " ";
|
|
137
|
-
display: block;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
h2,
|
|
142
|
-
h3,
|
|
143
|
-
h4,
|
|
144
|
-
h5,
|
|
145
|
-
h6 {
|
|
146
|
-
margin: 20px 0 10px;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
h2 {
|
|
150
|
-
margin-top: 40px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
p code,
|
|
154
|
-
li code,
|
|
155
|
-
table code {
|
|
156
|
-
padding: 2px 4px;
|
|
157
|
-
border-radius: 3px;
|
|
158
|
-
background-color: var(--code-background-color);
|
|
159
|
-
border: solid 1px var(--code-background-color); /* same color, useful when printing without background graphics */
|
|
160
|
-
color: var(--code-color);
|
|
161
|
-
font-family: var(--monospace);
|
|
162
|
-
font-size: 0.85rem;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
p,
|
|
166
|
-
ul {
|
|
167
|
-
line-height: 1.618rem;
|
|
168
|
-
margin-bottom: 1rem;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
ul {
|
|
172
|
-
padding-left: 40px;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
hr {
|
|
176
|
-
margin: 40px 0;
|
|
177
|
-
background-color: var(--separator-color);
|
|
178
|
-
height: 1px;
|
|
179
|
-
border: 0;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
blockquote {
|
|
183
|
-
background-color: var(--blockquote-background-color);
|
|
184
|
-
border: solid 1px var(--blockquote-border-color);
|
|
185
|
-
border-radius: 8px;
|
|
186
|
-
padding: 0.5em 1em;
|
|
187
|
-
color: var(--blockquote-color);
|
|
188
|
-
margin: 20px 0;
|
|
189
|
-
|
|
190
|
-
p {
|
|
191
|
-
margin-bottom: 0;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
code {
|
|
195
|
-
background-color: rgb(169 156 231 / 22%);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
img {
|
|
200
|
-
max-width: 100%;
|
|
201
|
-
margin: 20px auto;
|
|
202
|
-
display: block;
|
|
203
|
-
object-fit: contain;
|
|
204
|
-
height: auto;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
a {
|
|
208
|
-
color: var(--link-color);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
table {
|
|
212
|
-
padding: 0;
|
|
213
|
-
border-collapse: collapse;
|
|
214
|
-
margin-bottom: 20px;
|
|
215
|
-
display: block;
|
|
216
|
-
max-width: 100%;
|
|
217
|
-
overflow-x: auto;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
table tr {
|
|
221
|
-
border-top: 1px solid var(--table-border-color);
|
|
222
|
-
background-color: var(--table-odd-lines-background-color);
|
|
223
|
-
margin: 0;
|
|
224
|
-
padding: 0;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
table tr:nth-child(2n) {
|
|
228
|
-
background-color: var(--table-even-lines-background-color);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
table tr th {
|
|
232
|
-
font-weight: bold;
|
|
233
|
-
border: 1px solid var(--table-border-color);
|
|
234
|
-
text-align: left;
|
|
235
|
-
margin: 0;
|
|
236
|
-
padding: 6px 13px;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
table tr td {
|
|
240
|
-
border: 1px solid var(--table-border-color);
|
|
241
|
-
text-align: left;
|
|
242
|
-
margin: 0;
|
|
243
|
-
padding: 6px 13px;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
table tr th :first-child,
|
|
247
|
-
table tr td :first-child {
|
|
248
|
-
margin-top: 0;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
table tr th :last-child,
|
|
252
|
-
table tr td :last-child {
|
|
253
|
-
margin-bottom: 0;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
pre code {
|
|
257
|
-
margin-bottom: 1rem;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
pre.astro-code {
|
|
261
|
-
margin-bottom: 20px;
|
|
262
|
-
font-size: 0.85rem;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.header-anchor {
|
|
266
|
-
float: left;
|
|
267
|
-
margin-left: -0.87em;
|
|
268
|
-
padding-right: 0.23em;
|
|
269
|
-
font-weight: 500;
|
|
270
|
-
opacity: 0;
|
|
271
|
-
transition: opacity 0.25s;
|
|
272
|
-
text-decoration: none;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
h1:hover .header-anchor,
|
|
276
|
-
h2:hover .header-anchor,
|
|
277
|
-
h3:hover .header-anchor,
|
|
278
|
-
h4:hover .header-anchor,
|
|
279
|
-
h5:hover .header-anchor,
|
|
280
|
-
h6:hover .header-anchor,
|
|
281
|
-
.header-anchor:focus {
|
|
282
|
-
opacity: 1;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.siblings {
|
|
287
|
-
display: flex;
|
|
288
|
-
margin-right: calc(var(--toc-width) + 80px);
|
|
289
|
-
color: var(--link-color);
|
|
290
|
-
margin-top: 80px;
|
|
291
|
-
gap: 20px;
|
|
292
|
-
flex-wrap: wrap;
|
|
293
|
-
|
|
294
|
-
.sibling-link {
|
|
295
|
-
text-decoration: none;
|
|
296
|
-
border-radius: 2px;
|
|
297
|
-
|
|
298
|
-
&:focus-visible {
|
|
299
|
-
outline: solid 1px var(--separator-color);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.sibling-link--next {
|
|
304
|
-
text-align: right;
|
|
305
|
-
margin-left: auto;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
</style>
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
</script>
|
|
74
74
|
|
|
75
75
|
<style>
|
|
76
|
-
@import "reveal.js/
|
|
77
|
-
@import "reveal.js/
|
|
76
|
+
@import "reveal.js/reveal.css";
|
|
77
|
+
@import "reveal.js/theme/black.css";
|
|
78
78
|
@import "../style/slides.css";
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
#app {
|
|
81
81
|
height: 100%;
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -60,7 +60,7 @@ const tableOfContent = getHeadings()
|
|
|
60
60
|
|
|
61
61
|
<WorkspaceLayout title={title} description={description} isNotFoundPage={false}>
|
|
62
62
|
<ContentWrapper name={name} tableOfContent={tableOfContent}>
|
|
63
|
-
<Content/>
|
|
63
|
+
<Content />
|
|
64
64
|
</ContentWrapper>
|
|
65
65
|
</WorkspaceLayout>
|
|
66
66
|
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/* Putting the style from the ContentWrapper component here so that no "flash" occur in dev mode with HMR */
|
|
2
|
+
.page .content-wrapper .markdown-content {
|
|
3
|
+
margin-right: calc(var(--toc-width) + 80px);
|
|
4
|
+
|
|
5
|
+
h1,
|
|
6
|
+
h2,
|
|
7
|
+
h3,
|
|
8
|
+
h4,
|
|
9
|
+
h5 {
|
|
10
|
+
&:before {
|
|
11
|
+
/* hack to offset scroll on route hash navigation */
|
|
12
|
+
padding-top: calc(var(--top-bar-height) - 1px);
|
|
13
|
+
margin-top: calc((var(--top-bar-height) - 1px) * -1);
|
|
14
|
+
content: " ";
|
|
15
|
+
display: block;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h2,
|
|
20
|
+
h3,
|
|
21
|
+
h4,
|
|
22
|
+
h5,
|
|
23
|
+
h6 {
|
|
24
|
+
margin: 20px 0 10px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h2 {
|
|
28
|
+
margin-top: 40px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
p code,
|
|
32
|
+
li code,
|
|
33
|
+
table code {
|
|
34
|
+
padding: 2px 4px;
|
|
35
|
+
border-radius: 3px;
|
|
36
|
+
background-color: var(--code-background-color);
|
|
37
|
+
border: solid 1px var(--code-background-color); /* same color, useful when printing without background graphics */
|
|
38
|
+
color: var(--code-color);
|
|
39
|
+
font-family: var(--monospace);
|
|
40
|
+
font-size: 0.85rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
p,
|
|
44
|
+
ul {
|
|
45
|
+
line-height: 1.618rem;
|
|
46
|
+
margin-bottom: 1rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
ul {
|
|
50
|
+
padding-left: 40px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
hr {
|
|
54
|
+
margin: 40px 0;
|
|
55
|
+
background-color: var(--separator-color);
|
|
56
|
+
height: 1px;
|
|
57
|
+
border: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
blockquote {
|
|
61
|
+
background-color: var(--blockquote-background-color);
|
|
62
|
+
border: solid 1px var(--blockquote-border-color);
|
|
63
|
+
border-radius: 8px;
|
|
64
|
+
padding: 0.5em 1em;
|
|
65
|
+
color: var(--blockquote-color);
|
|
66
|
+
margin: 20px 0;
|
|
67
|
+
|
|
68
|
+
p {
|
|
69
|
+
margin-bottom: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
code {
|
|
73
|
+
background-color: rgb(169 156 231 / 22%);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
img {
|
|
78
|
+
max-width: 100%;
|
|
79
|
+
margin: 20px auto;
|
|
80
|
+
display: block;
|
|
81
|
+
object-fit: contain;
|
|
82
|
+
height: auto;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
a {
|
|
86
|
+
color: var(--link-color);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
table {
|
|
90
|
+
padding: 0;
|
|
91
|
+
border-collapse: collapse;
|
|
92
|
+
margin-bottom: 20px;
|
|
93
|
+
display: block;
|
|
94
|
+
max-width: 100%;
|
|
95
|
+
overflow-x: auto;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
table tr {
|
|
99
|
+
border-top: 1px solid var(--table-border-color);
|
|
100
|
+
background-color: var(--table-odd-lines-background-color);
|
|
101
|
+
margin: 0;
|
|
102
|
+
padding: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
table tr:nth-child(2n) {
|
|
106
|
+
background-color: var(--table-even-lines-background-color);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
table tr th {
|
|
110
|
+
font-weight: bold;
|
|
111
|
+
border: 1px solid var(--table-border-color);
|
|
112
|
+
text-align: left;
|
|
113
|
+
margin: 0;
|
|
114
|
+
padding: 6px 13px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
table tr td {
|
|
118
|
+
border: 1px solid var(--table-border-color);
|
|
119
|
+
text-align: left;
|
|
120
|
+
margin: 0;
|
|
121
|
+
padding: 6px 13px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
table tr th :first-child,
|
|
125
|
+
table tr td :first-child {
|
|
126
|
+
margin-top: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
table tr th :last-child,
|
|
130
|
+
table tr td :last-child {
|
|
131
|
+
margin-bottom: 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
pre code {
|
|
135
|
+
margin-bottom: 1rem;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
pre.astro-code {
|
|
139
|
+
margin-bottom: 20px;
|
|
140
|
+
font-size: 0.85rem;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.header-anchor {
|
|
144
|
+
float: left;
|
|
145
|
+
margin-left: -0.87em;
|
|
146
|
+
padding-right: 0.23em;
|
|
147
|
+
font-weight: 500;
|
|
148
|
+
opacity: 0;
|
|
149
|
+
transition: opacity 0.25s;
|
|
150
|
+
text-decoration: none;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
h1:hover .header-anchor,
|
|
154
|
+
h2:hover .header-anchor,
|
|
155
|
+
h3:hover .header-anchor,
|
|
156
|
+
h4:hover .header-anchor,
|
|
157
|
+
h5:hover .header-anchor,
|
|
158
|
+
h6:hover .header-anchor,
|
|
159
|
+
.header-anchor:focus {
|
|
160
|
+
opacity: 1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.siblings {
|
|
165
|
+
display: flex;
|
|
166
|
+
margin-right: calc(var(--toc-width) + 80px);
|
|
167
|
+
color: var(--link-color);
|
|
168
|
+
margin-top: 80px;
|
|
169
|
+
gap: 20px;
|
|
170
|
+
flex-wrap: wrap;
|
|
171
|
+
|
|
172
|
+
.sibling-link {
|
|
173
|
+
text-decoration: none;
|
|
174
|
+
border-radius: 2px;
|
|
175
|
+
|
|
176
|
+
&:focus-visible {
|
|
177
|
+
outline: solid 1px var(--separator-color);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.sibling-link--next {
|
|
182
|
+
text-align: right;
|
|
183
|
+
margin-left: auto;
|
|
184
|
+
}
|
|
185
|
+
}
|
package/bin/config.js
CHANGED
|
@@ -13,6 +13,7 @@ import { createRequire } from "node:module"
|
|
|
13
13
|
import { packageDirectory } from "package-directory"
|
|
14
14
|
|
|
15
15
|
import { loadConfig } from "./loadConfig.js"
|
|
16
|
+
import Context from "./vitePluginCompiiile/models/Context.js";
|
|
16
17
|
|
|
17
18
|
const { argv, localIntegrations, configFromFile, source, hasPublicFiles, publicDir } = await loadConfig()
|
|
18
19
|
|
|
@@ -38,6 +39,9 @@ if (packageDir) {
|
|
|
38
39
|
viteServerFsAllowList.push(packageDir)
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
let sharedContext = new Context()
|
|
43
|
+
sharedContext.filesTree = await sharedContext.scanDirectoryRecursively(".")
|
|
44
|
+
|
|
41
45
|
const astroConfig = {
|
|
42
46
|
server: {
|
|
43
47
|
host: argv.host,
|
|
@@ -56,39 +60,21 @@ const astroConfig = {
|
|
|
56
60
|
{
|
|
57
61
|
name: "include-dependencies",
|
|
58
62
|
hooks: {
|
|
59
|
-
"astro:build:setup": ({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"@babel/parser",
|
|
68
|
-
"estree-walker",
|
|
69
|
-
"source-map-js",
|
|
70
|
-
"@vue/runtime-dom",
|
|
71
|
-
"@vue/runtime-core",
|
|
72
|
-
"@vue/reactivity",
|
|
73
|
-
"@vue/server-renderer",
|
|
74
|
-
"@vue/compiler-ssr",
|
|
75
|
-
"html-escaper",
|
|
76
|
-
"@oslojs/encoding",
|
|
77
|
-
"cssesc",
|
|
78
|
-
"fzf",
|
|
79
|
-
"@astrojs/internal-helpers",
|
|
80
|
-
"mrmime",
|
|
81
|
-
"zod",
|
|
82
|
-
"entities",
|
|
83
|
-
"piccolore"
|
|
84
|
-
)
|
|
63
|
+
"astro:build:setup": ({ updateConfig }) => {
|
|
64
|
+
updateConfig({
|
|
65
|
+
vite: {
|
|
66
|
+
ssr: {
|
|
67
|
+
noExternal: true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
})
|
|
85
71
|
}
|
|
86
72
|
}
|
|
87
73
|
}
|
|
88
74
|
],
|
|
89
75
|
...(process.env.VITE_COMPIIILE_SITE_URL ? { site: process.env.VITE_COMPIIILE_SITE_URL } : {}),
|
|
90
76
|
vite: {
|
|
91
|
-
plugins: [compiiile()],
|
|
77
|
+
plugins: [compiiile(sharedContext)],
|
|
92
78
|
resolve: {
|
|
93
79
|
preserveSymlinks: true,
|
|
94
80
|
alias: {
|
|
@@ -101,7 +87,7 @@ const astroConfig = {
|
|
|
101
87
|
}
|
|
102
88
|
}
|
|
103
89
|
},
|
|
104
|
-
markdown: markdownConfig,
|
|
90
|
+
markdown: markdownConfig(sharedContext),
|
|
105
91
|
output: "static",
|
|
106
92
|
base: "/",
|
|
107
93
|
trailingSlash: "never",
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import Context from "./models/Context.js"
|
|
2
2
|
import { createMarkdownProcessor } from "@astrojs/markdown-remark"
|
|
3
|
-
import
|
|
3
|
+
import {rehypePlugins, remarkPlugins, shikiConfig} from "./markdownConfig.js"
|
|
4
4
|
import path from "node:path"
|
|
5
5
|
import { loadConfig } from "../loadConfig.js"
|
|
6
6
|
import { promises as fs } from "node:fs"
|
|
7
7
|
|
|
8
8
|
const source = "."
|
|
9
9
|
|
|
10
|
-
let context = null
|
|
11
|
-
|
|
12
10
|
const pathFromSource = (filePath) => {
|
|
13
11
|
return filePath?.replace(process.env.COMPIIILE_SOURCE + "/", "")
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
export default function compiiile() {
|
|
14
|
+
export default function compiiile(sharedContext) {
|
|
17
15
|
const virtualModuleId = "virtual:compiiile"
|
|
18
16
|
const resolvedVirtualModuleId = "\0" + virtualModuleId
|
|
19
17
|
|
|
@@ -29,14 +27,10 @@ export default function compiiile() {
|
|
|
29
27
|
return
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return `const fileList = ${JSON.stringify(context.fileList)};\n\n
|
|
37
|
-
const filesTree = ${JSON.stringify(context.filesTree)};\n\n
|
|
38
|
-
const routeList = ${JSON.stringify(context.routeList)};\n\n
|
|
39
|
-
const site = ${JSON.stringify(context.site)};\n\n
|
|
30
|
+
return `const fileList = ${JSON.stringify(sharedContext.fileList)};\n\n
|
|
31
|
+
const filesTree = ${JSON.stringify(sharedContext.filesTree)};\n\n
|
|
32
|
+
const routeList = ${JSON.stringify(sharedContext.routeList)};\n\n
|
|
33
|
+
const site = ${JSON.stringify(sharedContext.site)};\n\n
|
|
40
34
|
export { fileList, filesTree, routeList, site };`
|
|
41
35
|
},
|
|
42
36
|
async hotUpdate({ file, read }) {
|
|
@@ -47,12 +41,12 @@ export default function compiiile() {
|
|
|
47
41
|
try {
|
|
48
42
|
const content = await read()
|
|
49
43
|
|
|
50
|
-
const routeListItem =
|
|
44
|
+
const routeListItem = sharedContext.routeList.find((route) => route.fullPath === absolutePath)
|
|
51
45
|
|
|
52
|
-
const markdownProcessor = await createMarkdownProcessor(
|
|
46
|
+
const markdownProcessor = await createMarkdownProcessor({remarkPlugins, rehypePlugins: rehypePlugins(sharedContext), shikiConfig})
|
|
53
47
|
const renderedMarkdown = await markdownProcessor.render(content)
|
|
54
48
|
|
|
55
|
-
const title =
|
|
49
|
+
const title = sharedContext.getFileTitleFromProcessedMarkdown(renderedMarkdown)
|
|
56
50
|
const meta = renderedMarkdown.metadata.frontmatter
|
|
57
51
|
meta.title = title || path.parse(file).name
|
|
58
52
|
|
|
@@ -64,11 +58,11 @@ export default function compiiile() {
|
|
|
64
58
|
const currentStateIsAsSlides = !!meta.asSlides
|
|
65
59
|
|
|
66
60
|
if (prevStateWasAsSlides !== currentStateIsAsSlides) {
|
|
67
|
-
const newRoutePath =
|
|
61
|
+
const newRoutePath = sharedContext.generateRoutePathFromFilePath(
|
|
68
62
|
routeListItem.fullPath,
|
|
69
63
|
"",
|
|
70
64
|
currentStateIsAsSlides,
|
|
71
|
-
|
|
65
|
+
sharedContext.getEntryFileMatcher([routeListItem.fullPath])
|
|
72
66
|
)
|
|
73
67
|
|
|
74
68
|
this.environment.hot.send({
|
|
@@ -5,26 +5,34 @@ import rehypeSlug from "rehype-slug"
|
|
|
5
5
|
import rehypeAutolinkHeadings from "rehype-autolink-headings"
|
|
6
6
|
import { h } from "hastscript"
|
|
7
7
|
import rehypeHandleYamlMatterPlugin from "./rehypeHandleYamlMatterPlugin.js"
|
|
8
|
+
import { unified } from '@astrojs/markdown-remark';
|
|
8
9
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
tabIndex: -1,
|
|
23
|
-
class: "header-anchor"
|
|
24
|
-
}
|
|
10
|
+
export const remarkPlugins = [remarkEmoji]
|
|
11
|
+
export const rehypePlugins = (sharedContext) => [
|
|
12
|
+
rehypeImagePlugin,
|
|
13
|
+
rehypeSlug,
|
|
14
|
+
[
|
|
15
|
+
rehypeAutolinkHeadings,
|
|
16
|
+
{
|
|
17
|
+
behavior: "prepend",
|
|
18
|
+
content: () => [h("span", "#")],
|
|
19
|
+
properties: {
|
|
20
|
+
ariaHidden: true,
|
|
21
|
+
tabIndex: -1,
|
|
22
|
+
class: "header-anchor"
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
rehypeHandleYamlMatterPlugin
|
|
24
|
+
}
|
|
28
25
|
],
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
rehypeHandleYamlMatterPlugin,
|
|
27
|
+
[rehypeLinkPlugin, sharedContext]
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
export const shikiConfig = { theme: "css-variables" }
|
|
31
|
+
|
|
32
|
+
export default (sharedContext) => ({
|
|
33
|
+
processor: unified({
|
|
34
|
+
remarkPlugins,
|
|
35
|
+
rehypePlugins: rehypePlugins(sharedContext)
|
|
36
|
+
}),
|
|
37
|
+
shikiConfig
|
|
38
|
+
})
|
|
@@ -5,7 +5,7 @@ import FileListItem from "./FileListItem.js"
|
|
|
5
5
|
import FilesTreeItem from "./FilesTreeItem.js"
|
|
6
6
|
import RouteListItem from "./RouteListItem.js"
|
|
7
7
|
import { createMarkdownProcessor } from "@astrojs/markdown-remark"
|
|
8
|
-
import
|
|
8
|
+
import {remarkPlugins, rehypePlugins, shikiConfig} from "../markdownConfig.js"
|
|
9
9
|
import { unemojify } from "node-emoji"
|
|
10
10
|
import slugify from "slugify"
|
|
11
11
|
import parseIgnore from "parse-gitignore"
|
|
@@ -152,7 +152,7 @@ export default class {
|
|
|
152
152
|
encoding: "utf8"
|
|
153
153
|
})
|
|
154
154
|
|
|
155
|
-
const markdownProcessor = await createMarkdownProcessor(
|
|
155
|
+
const markdownProcessor = await createMarkdownProcessor({remarkPlugins, rehypePlugins: rehypePlugins(this), shikiConfig})
|
|
156
156
|
const renderedMarkdown = await markdownProcessor.render(markdownContent)
|
|
157
157
|
|
|
158
158
|
fileListItem.textContent = unemojify(
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { visit } from "unist-util-visit"
|
|
2
2
|
|
|
3
|
-
export default function rehypeLinkPlugin() {
|
|
3
|
+
export default function rehypeLinkPlugin(sharedContext) {
|
|
4
4
|
return (tree, file) => {
|
|
5
|
-
const context = JSON.parse(process.env.context || "{}")
|
|
6
5
|
visit(tree, "element", (node) => {
|
|
7
6
|
if (node.tagName === "a") {
|
|
8
7
|
if (node.properties.href.match(/^\.{1,2}\/.*/)) {
|
|
@@ -10,8 +9,9 @@ export default function rehypeLinkPlugin() {
|
|
|
10
9
|
const path = decodeURI(linkTargetUrl.pathname).replaceAll("%20", " ")
|
|
11
10
|
const decodedFilePath = decodeURIComponent(decodeURIComponent(path))
|
|
12
11
|
const filePath = decodedFilePath.replace(process.env.COMPIIILE_SOURCE, "")
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
node.properties.href = sharedContext?.fileRouteMap?.[filePath.substring(1)] + linkTargetUrl.hash
|
|
14
|
+
} else if(!node.properties.href.startsWith("#")){
|
|
15
15
|
node.properties.target = "_blank"
|
|
16
16
|
}
|
|
17
17
|
}
|