@compiiile/compiiile 2.18.12 → 2.19.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.
@@ -5,6 +5,7 @@
5
5
  :key="navItem.uuid"
6
6
  :item="navItem"
7
7
  :current-path="currentPath"
8
+ :tree-path="navItem.name"
8
9
  />
9
10
  </ul>
10
11
  </template>
@@ -15,6 +15,10 @@
15
15
  type: String,
16
16
  required: true
17
17
  }
18
+ },
19
+ mounted() {
20
+ // This is to delegate folder state to the client instead of the values computed on page load to prevent blinking
21
+ document.getElementById("compiiile-folders-state-style")?.remove()
18
22
  }
19
23
  }
20
24
  </script>
@@ -1,35 +1,61 @@
1
1
  <template>
2
2
  <li v-if="isVisible(item)" class="nav-list-item no-wrap">
3
3
  <template v-if="item.isDirectory">
4
- <svg
5
- class="directory-icon"
6
- xmlns="http://www.w3.org/2000/svg"
7
- width="15"
8
- height="15"
9
- fill="none"
10
- viewBox="0 0 256 256"
4
+ <button
5
+ class="directory-toggle"
6
+ type="button"
7
+ :data-folder-id="folderId"
8
+ aria-label="Toggle open directory"
9
+ @click="toggleIsOpen"
11
10
  >
12
- <path
13
- d="M216.9,208H39.4a7.4,7.4,0,0,1-7.4-7.4V80H216a8,8,0,0,1,8,8V200.9A7.1,7.1,0,0,1,216.9,208Z"
14
- stroke-linecap="round"
15
- stroke-linejoin="round"
16
- stroke-width="16"
17
- ></path>
18
- <path
19
- d="M32,80V56a8,8,0,0,1,8-8H92.7a7.9,7.9,0,0,1,5.6,2.3L128,80"
20
- stroke-linecap="round"
21
- stroke-linejoin="round"
22
- stroke-width="16"
23
- ></path>
24
- </svg>
25
-
26
- <span class="directory-name">{{ item.name }}</span>
27
- <ul v-if="item.children.length > 0" class="nav-list-item-children">
11
+ <svg
12
+ class="directory-caret"
13
+ :class="{ 'directory-caret--open': isOpen }"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ width="12"
16
+ height="12"
17
+ fill="none"
18
+ viewBox="0 0 256 256"
19
+ >
20
+ <polyline
21
+ points="96 48 176 128 96 208"
22
+ stroke-linecap="round"
23
+ stroke-linejoin="round"
24
+ stroke-width="24"
25
+ ></polyline>
26
+ </svg>
27
+ <svg
28
+ class="directory-icon"
29
+ xmlns="http://www.w3.org/2000/svg"
30
+ width="15"
31
+ height="15"
32
+ fill="none"
33
+ viewBox="0 0 256 256"
34
+ >
35
+ <path
36
+ d="M216.9,208H39.4a7.4,7.4,0,0,1-7.4-7.4V80H216a8,8,0,0,1,8,8V200.9A7.1,7.1,0,0,1,216.9,208Z"
37
+ stroke-linecap="round"
38
+ stroke-linejoin="round"
39
+ stroke-width="16"
40
+ ></path>
41
+ <path
42
+ d="M32,80V56a8,8,0,0,1,8-8H92.7a7.9,7.9,0,0,1,5.6,2.3L128,80"
43
+ stroke-linecap="round"
44
+ stroke-linejoin="round"
45
+ stroke-width="16"
46
+ ></path>
47
+ </svg>
48
+
49
+ <span class="directory-name">{{ item.name }}</span>
50
+ </button>
51
+
52
+ <ul v-if="isOpen && item.children.length > 0" class="nav-list-item-children">
28
53
  <nav-list-item
29
54
  v-for="child in item.children"
30
55
  :key="child.uuid"
31
56
  :item="child"
32
57
  :current-path="currentPath"
58
+ :tree-path="`${treePath}/${child.name}`"
33
59
  />
34
60
  </ul>
35
61
  </template>
@@ -140,6 +166,14 @@
140
166
  </template>
141
167
 
142
168
  <script>
169
+ import { site } from "virtual:compiiile"
170
+
171
+ const FOLDERS_STATE_KEY = "COMPIIILE_FOLDERS_STATE"
172
+
173
+ const getFoldersState = () => {
174
+ return JSON.parse(localStorage.getItem(FOLDERS_STATE_KEY) || "{}")
175
+ }
176
+
143
177
  export default {
144
178
  name: "NavListItem",
145
179
  props: {
@@ -150,14 +184,68 @@
150
184
  currentPath: {
151
185
  type: String,
152
186
  required: true
187
+ },
188
+ treePath: {
189
+ type: String,
190
+ required: true
191
+ }
192
+ },
193
+ data() {
194
+ return {
195
+ isOpen: true
153
196
  }
154
197
  },
155
198
  computed: {
156
199
  route() {
157
200
  return this.$context.routeList.find((route) => route.name === this.item.uuid)
201
+ },
202
+ folderId() {
203
+ // We don't use the uuid but the full tree path so that it's persistent across builds
204
+ return encodeURIComponent(this.treePath)
158
205
  }
159
206
  },
207
+ watch: {
208
+ currentPath() {
209
+ if (this.item.isDirectory && this.containsCurrentPath(this.item)) {
210
+ this.isOpen = true
211
+ }
212
+ }
213
+ },
214
+ mounted() {
215
+ this.computeIsOpen()
216
+ },
160
217
  methods: {
218
+ computeIsOpen() {
219
+ if (!this.item.isDirectory) {
220
+ return
221
+ }
222
+
223
+ const currentFoldersState = getFoldersState()
224
+
225
+ this.isOpen =
226
+ this.containsCurrentPath(this.item) ||
227
+ (Object.prototype.hasOwnProperty.call(currentFoldersState, this.folderId)
228
+ ? currentFoldersState[this.folderId]
229
+ : !site.collapseFolders)
230
+ },
231
+ containsCurrentPath(item) {
232
+ if (!item.isDirectory) {
233
+ const route = this.$context.routeList.find((route) => route.name === item.uuid)
234
+ return route?.path === this.currentPath
235
+ }
236
+
237
+ return item.children.some((child) => this.containsCurrentPath(child))
238
+ },
239
+ toggleIsOpen() {
240
+ this.isOpen = !this.isOpen
241
+
242
+ const currentFoldersState = getFoldersState()
243
+ const newFoldersState = {
244
+ ...currentFoldersState,
245
+ [this.folderId]: this.isOpen
246
+ }
247
+ localStorage.setItem(FOLDERS_STATE_KEY, JSON.stringify(newFoldersState))
248
+ },
161
249
  isVisible(item) {
162
250
  if (!item.isDirectory) {
163
251
  const route = this.$context.routeList.find((route) => route.name === item.uuid)
@@ -188,6 +276,37 @@
188
276
  line-height: 1rem;
189
277
  }
190
278
 
279
+ .directory-toggle {
280
+ display: inline-flex;
281
+ align-items: center;
282
+ gap: 3px;
283
+ padding: 0 3px 0 0;
284
+ border: none;
285
+ border-radius: 4px;
286
+ appearance: none;
287
+ background: transparent;
288
+ color: inherit;
289
+ cursor: pointer;
290
+ font: inherit;
291
+ text-align: left;
292
+
293
+ &:focus-visible {
294
+ outline: solid 1px var(--separator-color);
295
+ outline-offset: 2px;
296
+ }
297
+ }
298
+
299
+ .directory-caret {
300
+ stroke: var(--dimmed-text-color);
301
+ transform: rotate(0);
302
+ transition: transform 0.1s linear;
303
+ will-change: transform;
304
+ }
305
+
306
+ .directory-caret--open {
307
+ transform: rotate(90deg);
308
+ }
309
+
191
310
  .directory-icon {
192
311
  margin-left: 2px;
193
312
  }
@@ -200,9 +319,6 @@
200
319
 
201
320
  .directory-name {
202
321
  display: inline;
203
- margin-left: 3px;
204
- position: relative;
205
- top: -2px;
206
322
  }
207
323
 
208
324
  .file-icon {
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import ThemeLoader from "./ThemeLoader.astro";
3
+ import NavBarFoldersStateLoader from "./NavBarFoldersStateLoader.astro";
3
4
  import '../utils/styles.js'
4
5
  import {SEO} from "astro-seo"
5
6
  const {title, description, isNotFoundPage} = Astro.props
@@ -37,6 +38,7 @@ const defaultTheme = site.theme
37
38
  }}
38
39
  />}
39
40
  <ThemeLoader defaultTheme={defaultTheme}/>
41
+ <NavBarFoldersStateLoader />
40
42
  </head>
41
43
  <body>
42
44
  <slot></slot>
@@ -0,0 +1,81 @@
1
+ ---
2
+ import { site, routeList, filesTree } from "virtual:compiiile"
3
+
4
+ let currentPath = Astro.url.pathname
5
+ if(currentPath.length > 1 && currentPath.endsWith("/")){
6
+ currentPath = currentPath.slice(0, -1)
7
+ }
8
+
9
+ const foldersContainingCurrentPath = {}
10
+
11
+ // Here we manually compute folders that have to be opened on page load if they contain the current page to display
12
+ const scanFoldersContainingCurrentPath = (folder, fullPath) => {
13
+ return folder.children.some(item => {
14
+ if (item.isDirectory) {
15
+ const childPath = `${fullPath}/${item.name}`;
16
+ const childContainsCurrentPath = scanFoldersContainingCurrentPath(item, childPath);
17
+
18
+ if (childContainsCurrentPath) {
19
+ foldersContainingCurrentPath[encodeURIComponent(fullPath)] = true;
20
+ }
21
+
22
+ return childContainsCurrentPath;
23
+ }
24
+
25
+ const matchesCurrentPath = routeList.find(r => r.name === item.uuid)?.path === currentPath;
26
+
27
+ if (matchesCurrentPath) {
28
+ foldersContainingCurrentPath[encodeURIComponent(fullPath)] = true;
29
+ }
30
+
31
+ return matchesCurrentPath;
32
+ });
33
+ };
34
+
35
+ for(const navListItem of filesTree){
36
+ if(navListItem.isDirectory){
37
+ scanFoldersContainingCurrentPath(navListItem, navListItem.name)
38
+ }
39
+ }
40
+
41
+ ---
42
+
43
+ <script is:inline define:vars={{ site, foldersContainingCurrentPath }}>
44
+ /*
45
+ We apply styles in the HTML head to prevent blinking navbar items on page load,
46
+ since their state is computed on the client side because it required localStorage access.
47
+ This style is then removed in `NavBar.vue` to delegate the toggle behavior to the client side.
48
+ */
49
+ const navStateStyle = document.createElement("style")
50
+ navStateStyle.id = "compiiile-folders-state-style"
51
+
52
+ const foldersState = {
53
+ ...JSON.parse(localStorage.getItem("COMPIIILE_FOLDERS_STATE") || "{}"),
54
+ // we overwrite the localStorage expanded (true) or collapsed (false) value if the folder contains the current path
55
+ ...foldersContainingCurrentPath
56
+ }
57
+
58
+ let navStateStyles = ""
59
+
60
+ // Default values for folder states based on the global parameter `collapseFolders`
61
+ if(site.collapseFolders){
62
+ navStateStyles += `nav .files-tree .nav-list-item-children { display: none !important; }\n`
63
+ navStateStyles += `nav .files-tree .directory-caret { transform: rotate(0); !important }\n`
64
+ } else {
65
+ navStateStyles += `nav .files-tree .nav-list-item-children { display: block !important; }\n`
66
+ navStateStyles += `nav .files-tree .directory-caret { transform: rotate(90deg); !important }\n`
67
+ }
68
+
69
+ // Custom style declaration to force correct rendering for specific folders on page load
70
+ for (const [treePath, isOpen] of Object.entries(foldersState)) {
71
+ if (isOpen) {
72
+ navStateStyles += `nav .files-tree [data-folder-id="${treePath}"] + .nav-list-item-children { display: block !important; }\n`
73
+ navStateStyles += `nav .files-tree [data-folder-id="${treePath}"] .directory-caret { transform: rotate(90deg); !important }\n`
74
+ } else {
75
+ navStateStyles += `nav .files-tree [data-folder-id="${treePath}"] + .nav-list-item-children { display: none !important; }\n`
76
+ navStateStyles += `nav .files-tree [data-folder-id="${treePath}"] .directory-caret { transform: rotate(0) !important; }\n`
77
+ }
78
+ }
79
+ navStateStyle.textContent = navStateStyles
80
+ document.head.appendChild(navStateStyle)
81
+ </script>
@@ -16,7 +16,7 @@ if(currentPath.length > 1 && currentPath.endsWith("/")){
16
16
  <div class="page">
17
17
  <TopBar client:load />
18
18
 
19
- <NavBar currentPath={ currentPath }/>
19
+ <NavBar currentPath={ currentPath } client:load/>
20
20
 
21
21
  <div class="centered-layout">
22
22
  <div class="content-wrapper">
@@ -558,6 +558,7 @@ The `CGrid` component allows you to use a grid layout (very useful for slides):
558
558
  </div>
559
559
 
560
560
  ![](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExdDI1d2lybmoycXA5NTQ1Y2N5Y3ZhOXVuYWxxcmh5MHJvMDdsbWdvcyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/SKT9pS2jJ3J7lrn51E/giphy-downsized-large.gif)
561
+
561
562
  </CGrid>
562
563
  ```
563
564
 
@@ -634,7 +635,6 @@ The `CDetails` component allows you to hide a block and reveal it by clicking on
634
635
  ```
635
636
  </CDetails>
636
637
 
637
-
638
638
  ### CSlide
639
639
 
640
640
  The `CSlide` component can be used for every slide, it allows you to align content the way you want (horizontally and vertically), and to use custom themes.
@@ -656,8 +656,8 @@ The `CSlide` component can be used for every slide, it allows you to align conte
656
656
 
657
657
  </CSlide>
658
658
  ```
659
- </CDetails>
660
659
 
660
+ </CDetails>
661
661
 
662
662
  ### CGap
663
663
 
@@ -666,7 +666,7 @@ The `CGap` component can be used in slides, allowing you to add a gap between el
666
666
  - The gap can be set with the `width` and `height` prop (accepting CSS values).
667
667
 
668
668
  <CDetails summary="Example">
669
- ```mdx
670
- <CGap height="100px" />
671
- ```
669
+ ```mdx
670
+ <CGap height="100px" />
671
+ ```
672
672
  </CDetails>
package/5-pro-slides.mdx CHANGED
@@ -43,6 +43,7 @@ description: "Use icons, admonitions, mermaid diagrams, markmap mindmaps in Mark
43
43
 
44
44
  Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. From [xodnnhm](https://giphy.com/xodnnhm).
45
45
  </div>
46
+
46
47
  </CGrid>
47
48
 
48
49
  ---
@@ -68,6 +69,7 @@ description: "Use icons, admonitions, mermaid diagrams, markmap mindmaps in Mark
68
69
  <span slot="title">Title</span>
69
70
  <span slot="description">Some description</span>
70
71
  </CCard>
72
+
71
73
  </CGrid>
72
74
 
73
75
  ---
package/6-deploy.mdx CHANGED
@@ -30,6 +30,7 @@ You'll have all your static files generated in the `.compiiile/dist` folder, rea
30
30
  ## Deploy your Markdown files on Vercel :globe_with_meridians:
31
31
 
32
32
  In your project's `Settings` tab, put these settings:
33
+
33
34
  - Framework preset: `Other`
34
35
  - Build command: `compiiile build --title="Hello world!"`
35
36
  - Output directory: `.compiiile/dist`
package/README.md CHANGED
@@ -21,7 +21,8 @@ That's what Compiiile does. And it does it hassle-free !
21
21
  ## Features
22
22
 
23
23
  - [x] 📦 **No config required, everything just works out of the box, without changing your files** (resolves images and
24
- relative links (cross-references), print-ready rendering, :sunny: light and :first_quarter_moon_with_face: dark themes)
24
+ relative links (cross-references), print-ready rendering, :sunny: light and :first_quarter_moon_with_face: dark
25
+ themes)
25
26
  - [x] 🌱 Available everywhere with static files deployment: just host it somewhere and access it in any browser on your
26
27
  computer, phone or whatever you are using
27
28
  - [x] :link: Quick access to your files via the navbar and links to the previous and next file (with table of content
@@ -49,7 +50,8 @@ You can install Compiiile either globally or per-project:
49
50
 
50
51
  ### Globally
51
52
 
52
- Open a terminal and type one of these commands, whether using [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/) depending on which package manager you are using:
53
+ Open a terminal and type one of these commands, whether using [npm](https://www.npmjs.com/)
54
+ or [yarn](https://yarnpkg.com/) depending on which package manager you are using:
53
55
 
54
56
  ```bash
55
57
  yarn global add @compiiile/compiiile # install globally with yarn
@@ -188,14 +190,18 @@ Other frontmatter keys are handled:
188
190
  - `textAlign`: possible values
189
191
  are [CSS text-align values](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align) (`left`, `center`, ...). This
190
192
  changes the default text alignment in slides. The default value is `center`.
191
- - `ignore` : Boolean value (`true` or `false`) to ignore the current file and exclude it from Compiiile (the file is not ignored by default).
192
- - `hidden` : Boolean value (`true` or `false`) to hide the file from the navbar and siblings links (the file is not hidden by default).
193
+ - `ignore` : Boolean value (`true` or `false`) to ignore the current file and exclude it from Compiiile (the file is not
194
+ ignored by default).
195
+ - `hidden` : Boolean value (`true` or `false`) to hide the file from the navbar and siblings links (the file is not
196
+ hidden by default).
193
197
 
194
- > :bulb: You can override slides theme (light or dark) by passing it to a `theme` query parameter in your slide url (for example `/s/slides?theme=light`). See the `theme` config parameter below for valid values.
198
+ > :bulb: You can override slides theme (light or dark) by passing it to a `theme` query parameter in your slide url (for
199
+ > example `/s/slides?theme=light`). See the `theme` config parameter below for valid values.
195
200
 
196
201
  ### Routing
197
202
 
198
- The home page of Compiiile (`/`) points to a `README.md` file located at the root of your folder, or fallbacks to an `index.md` file.
203
+ The home page of Compiiile (`/`) points to a `README.md` file located at the root of your folder, or fallbacks to an
204
+ `index.md` file.
199
205
 
200
206
  ## Custom configuration
201
207
 
@@ -219,6 +225,7 @@ Here is the list of parameters that you can set to customize Compiiile (none are
219
225
  | `printReady` | `Boolean` | Add a `/print` page to display a full ready-to-print content (uses `@compiiile/compiiile-print`) |
220
226
  | `css` | `string` | A relative path to a custom CSS file to customize the style <br/>:warning: Requires `compiiile-pro` |
221
227
  | `integrations` | `AstroIntegration[]` | An array of Astro Integrations for [custom Astro hooks implementations](https://docs.astro.build/en/reference/integrations-reference/#astroconfigsetup): injecting CSS, javascript, etc |
228
+ | `collapseFolders` | `Boolean` | If set to `true`, folders in the navbar will be collapsed by default. Defaults to `false` |
222
229
 
223
230
  You can use these parameters in 2 ways:
224
231
 
@@ -249,13 +256,17 @@ export default {
249
256
 
250
257
  > ⚠️ You should bear in mind that script arguments have priority over config file parameters.
251
258
 
252
- > :bulb: Compiiile uses [c12](https://github.com/unjs/c12) to load the config file, which allows to **extend config values** from other files. See the [dedicated c12 documentation](https://github.com/unjs/c12?tab=readme-ov-file#extending-configuration) for more information.
259
+ > :bulb: Compiiile uses [c12](https://github.com/unjs/c12) to load the config file, which allows to **extend config
260
+ > values** from other files. See
261
+ > the [dedicated c12 documentation](https://github.com/unjs/c12?tab=readme-ov-file#extending-configuration) for more
262
+ > information.
253
263
 
254
264
  ## Public files
255
265
 
256
266
  If you want some files to be public, just create a folder named `public` at the root of your Compiiile folder.
257
267
 
258
- For example, if you want to link to a local PDF in your Markdown file, you can put your PDF in your local public directory, in `public/my-pdf.pdf`.
268
+ For example, if you want to link to a local PDF in your Markdown file, you can put your PDF in your local public
269
+ directory, in `public/my-pdf.pdf`.
259
270
  Then, all you have to do is creating a link in Markdown with an absolute path like so :
260
271
 
261
272
  ```markdown
@@ -317,7 +328,9 @@ import Test from "./Test.vue"
317
328
  <Test client:load />
318
329
  ```
319
330
 
320
- You should use [Astro's client directives](https://docs.astro.build/en/reference/directives-reference/#client-directives) to load your component's script (`client:load` is not necessary on all your components).
331
+ You should
332
+ use [Astro's client directives](https://docs.astro.build/en/reference/directives-reference/#client-directives) to load
333
+ your component's script (`client:load` is not necessary on all your components).
321
334
 
322
335
  ### Using config data values
323
336
 
@@ -342,9 +355,11 @@ description: some description
342
355
  { frontmatter.description }
343
356
  ```
344
357
 
345
- > :books: More info in the [dedicated Astro documentation](https://docs.astro.build/en/guides/integrations-guide/mdx/#using-frontmatter-variables-in-mdx).
358
+ > :books: More info in
359
+ > the [dedicated Astro documentation](https://docs.astro.build/en/guides/integrations-guide/mdx/#using-frontmatter-variables-in-mdx).
346
360
 
347
- In your custom components, you can access the current page's frontmatter by using the `pageFrontmatter` property from Compiiile's Vite plugin:
361
+ In your custom components, you can access the current page's frontmatter by using the `pageFrontmatter` property from
362
+ Compiiile's Vite plugin:
348
363
 
349
364
  ```vue
350
365
  <template>
@@ -367,9 +382,11 @@ In your custom components, you can access the current page's frontmatter by usin
367
382
 
368
383
  ## Ignoring files and folders
369
384
 
370
- To ignore a whole folder or some files matching a certain pattern, you can add a `.compiiileignore` at the root of the folder where you run Compiiile.
385
+ To ignore a whole folder or some files matching a certain pattern, you can add a `.compiiileignore` at the root of the
386
+ folder where you run Compiiile.
371
387
 
372
- This file accepts glob patterns to ignore files. For example, if you want to ignore files containing the word `preview` and files starting with a number,
388
+ This file accepts glob patterns to ignore files. For example, if you want to ignore files containing the word `preview`
389
+ and files starting with a number,
373
390
  you can simply put these 2 lines in your `.compiiileignore`:
374
391
 
375
392
  ```ignorelang
@@ -400,12 +417,15 @@ You can read more about it and the roadmap in the [dedicated contributing guide]
400
417
 
401
418
  You can add features to Compiiile by using the following projects:
402
419
 
403
- - [compiiile-pro](https://compiiile.me/c/3-pro-installation): Enhance your Markdown files, add diagrams, mindmaps, admonitions, and ready-made components
404
- - [compiiile-print](https://github.com/compiiile/compiiile-print): Add a print ready page containing all your Markdown files
420
+ - [compiiile-pro](https://compiiile.me/c/3-pro-installation): Enhance your Markdown files, add diagrams, mindmaps,
421
+ admonitions, and ready-made components
422
+ - [compiiile-print](https://github.com/compiiile/compiiile-print): Add a print ready page containing all your Markdown
423
+ files
405
424
 
406
425
  Here is a list of projects related to Compiiile developed by the community:
407
426
 
408
- - [compiiile-actions-cloudflare-pages](https://github.com/marketplace/actions/compiiile-cloudflare-pages): A simple GitHub action to deploy a Compiiile site to CloudFlare pages
427
+ - [compiiile-actions-cloudflare-pages](https://github.com/marketplace/actions/compiiile-cloudflare-pages): A simple
428
+ GitHub action to deploy a Compiiile site to CloudFlare pages
409
429
 
410
430
  ## Support
411
431
 
package/bin/loadConfig.js CHANGED
@@ -107,6 +107,10 @@ export const loadConfig = async () => {
107
107
  .option("printReady", {
108
108
  describe: "Add a /print page to display a full ready-to-print content (uses @compiiile/compiiile-print)"
109
109
  })
110
+ .option("collapseFolders", {
111
+ describe: "Whether folders are collapsed by default in the navbar (expanded by default)",
112
+ default: false
113
+ })
110
114
  .help()
111
115
  .version(packageJSON.version).argv
112
116
 
@@ -123,6 +127,8 @@ export const loadConfig = async () => {
123
127
  process.env.VITE_COMPIIILE_DATA = typeof argv.data === "string" ? argv.data : JSON.stringify(argv.data ?? {})
124
128
  process.env.VITE_COMPIIILE_USE_AUTO_TITLES = /true/i.test(argv.useAutoTitles) // defaults to `false` if not set or not equal to `true`
125
129
 
130
+ process.env.VITE_COMPIIILE_COLLAPSE_FOLDERS = /true/i.test(argv.collapseFolders) // defaults to `false` if not set or not equal to `true`
131
+
126
132
  // Handling logo and favicon
127
133
  process.env.VITE_COMPIIILE_LOGO = null
128
134
 
@@ -30,7 +30,8 @@ export default class {
30
30
  siteUrl: process.env.VITE_COMPIIILE_SITE_URL !== "" ? process.env.VITE_COMPIIILE_SITE_URL : undefined,
31
31
  base: process.env.VITE_COMPIIILE_BASE,
32
32
  data: JSON.parse(process.env.VITE_COMPIIILE_DATA),
33
- theme: process.env.VITE_COMPIIILE_THEME
33
+ theme: process.env.VITE_COMPIIILE_THEME,
34
+ collapseFolders: JSON.parse(process.env.VITE_COMPIIILE_COLLAPSE_FOLDERS)
34
35
  }
35
36
  }
36
37
 
@@ -7,15 +7,18 @@ export default {
7
7
  {
8
8
  name: "umami",
9
9
  hooks: {
10
- "astro:config:setup": ({injectScript}) => {
11
- if(process.env.ANALYTICS_URL && process.env.ANALYTICS_ID){
12
- injectScript('head-inline', `
10
+ "astro:config:setup": ({ injectScript }) => {
11
+ if (process.env.ANALYTICS_URL && process.env.ANALYTICS_ID) {
12
+ injectScript(
13
+ "head-inline",
14
+ `
13
15
  const script = document.createElement("script")
14
16
  script.setAttribute("src", "${process.env.ANALYTICS_URL}")
15
17
  script.dataset.websiteId = "${process.env.ANALYTICS_ID}"
16
18
  script.setAttribute("defer", "")
17
19
  document.head.appendChild(script)
18
- `);
20
+ `
21
+ )
19
22
  }
20
23
  }
21
24
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@compiiile/compiiile",
3
3
  "private": false,
4
- "version": "2.18.12",
4
+ "version": "2.19.0",
5
5
  "description": "The most convenient way to render a folder containing markdown files. Previewing and searching markdown files has never been that easy.",
6
6
  "author": "AlbanCrepel <alban.crepel@gmail.com>",
7
7
  "license": "GPL-3.0-only",