@compiiile/compiiile 2.13.4 → 2.14.1

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "_variables": {
3
- "lastUpdateCheck": 1724762294937
3
+ "lastUpdateCheck": 1725988838449
4
4
  }
5
5
  }
@@ -105,9 +105,15 @@
105
105
  return this.fileIndex > -1 ? this.$context.fileList[this.fileIndex] : null
106
106
  },
107
107
  fileSiblings() {
108
+ let visibleFiles = this.$context.fileList
109
+ if (!this.file.meta.hidden) {
110
+ visibleFiles = visibleFiles.filter((file) => !file.meta.hidden)
111
+ }
112
+ const newIndex = visibleFiles.findIndex((file) => file.uuid === this.name)
113
+
108
114
  return {
109
- prev: this.$context.fileList[this.fileIndex - 1] ?? null,
110
- next: this.$context.fileList[this.fileIndex + 1] ?? null
115
+ prev: visibleFiles[newIndex - 1] ?? null,
116
+ next: visibleFiles[newIndex + 1] ?? null
111
117
  }
112
118
  }
113
119
  }
@@ -195,7 +201,7 @@
195
201
  margin: 20px auto;
196
202
  display: block;
197
203
  object-fit: contain;
198
- height: auto;
204
+ height: auto;
199
205
  }
200
206
 
201
207
  a {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <li class="nav-list-item no-wrap">
2
+ <li v-if="isVisible(item)" class="nav-list-item no-wrap">
3
3
  <template v-if="item.isDirectory">
4
4
  <svg
5
5
  class="directory-icon"
@@ -156,6 +156,21 @@
156
156
  route() {
157
157
  return this.$context.routeList.find((route) => route.name === this.item.uuid)
158
158
  }
159
+ },
160
+ methods: {
161
+ isVisible(item) {
162
+ if (!item.isDirectory) {
163
+ const route = this.$context.routeList.find((route) => route.name === item.uuid)
164
+ return !route.meta.hidden
165
+ }
166
+
167
+ return (
168
+ item.children.length > 0 &&
169
+ item.children.some((child) => {
170
+ return this.isVisible(child)
171
+ })
172
+ )
173
+ }
159
174
  }
160
175
  }
161
176
  </script>
package/README.md CHANGED
@@ -184,6 +184,7 @@ Other frontmatter keys are handled:
184
184
  are [CSS text-align values](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align) (`left`, `center`, ...). This
185
185
  changes the default text alignment in slides. The default value is `center`.
186
186
  - `ignore` : Boolean value (`true` or `false`) to ignore the current file and exclude it from Compiiile (the file is not ignored by default).
187
+ - `hidden` : Boolean value (`true` or `false`) to hide the file from the navbar and siblings links (the file is not hidden by default).
187
188
 
188
189
  > :bulb: You can override slides theme 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.
189
190
 
@@ -323,6 +324,18 @@ import { site } from "virtual:compiiile"
323
324
  # {site.data.someProperty}
324
325
  ```
325
326
 
327
+ ## Ignoring files and folders
328
+
329
+ 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.
330
+
331
+ 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,
332
+ you can simply put these 2 lines in your `.compiiileignore`:
333
+
334
+ ```ignorelang
335
+ *preview*
336
+ [1-9]*
337
+ ```
338
+
326
339
  ## Common issues
327
340
 
328
341
  - Make sure that the absolute path to the folder where you are running Compiiile doesn't contain any special character
@@ -8,6 +8,8 @@ import { createMarkdownProcessor } from "@astrojs/markdown-remark"
8
8
  import markdownConfig from "../markdownConfig.js"
9
9
  import { unemojify } from "node-emoji"
10
10
  import slugify from "slugify"
11
+ import parseIgnore from "parse-gitignore"
12
+ import { minimatch } from "minimatch"
11
13
 
12
14
  export default class {
13
15
  WORKSPACE_BASE_PATH = "c"
@@ -80,6 +82,27 @@ export default class {
80
82
  ].includes(file)
81
83
  ) {
82
84
  const filePath = path.join(directoryPath, file)
85
+
86
+ try {
87
+ const compiiileIgnoreFilePath = fs.readFileSync(
88
+ path.join(process.env.COMPIIILE_SOURCE, ".compiiileignore")
89
+ )
90
+ const compiiileIgnore = parseIgnore(compiiileIgnoreFilePath)
91
+
92
+ const ignoreGlobs = compiiileIgnore.globs().filter((globType) => globType.type === "ignore")
93
+ const ignorePatterns = ignoreGlobs.reduce((patterns, currentIgnoreGlobItem) => {
94
+ return [...patterns, ...currentIgnoreGlobItem.patterns]
95
+ }, [])
96
+
97
+ const isFilePathInIgnoredPatterns = ignorePatterns.some((pattern) => minimatch(filePath, pattern))
98
+
99
+ if (isFilePathInIgnoredPatterns) {
100
+ continue
101
+ }
102
+ } catch (e) {
103
+ // No .compiiileignore file found at the root
104
+ }
105
+
83
106
  const isDirectory = fs.statSync(filePath).isDirectory()
84
107
  const uuid = uuidv4()
85
108
  const fileName = path.parse(filePath).name
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@compiiile/compiiile",
3
3
  "private": false,
4
- "version": "2.13.4",
4
+ "version": "2.14.1",
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",
@@ -39,7 +39,9 @@
39
39
  "eslint-plugin-vue": "^9.17.0",
40
40
  "fzf": "^0.5.2",
41
41
  "hastscript": "^9.0.0",
42
+ "minimatch": "^10.0.1",
42
43
  "node-emoji": "^2.1.0",
44
+ "parse-gitignore": "^2.0.0",
43
45
  "pkg-dir": "^7.0.0",
44
46
  "prettier": "^3.0.3",
45
47
  "rehype-autolink-headings": "^7.1.0",