@compiiile/compiiile 2.9.2 → 2.10.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.
@@ -4,6 +4,10 @@ const { defaultTheme } = Astro.props
4
4
 
5
5
  <script is:inline define:vars={{ defaultTheme }}>
6
6
  const theme = (() => {
7
+ const themeQueryParameter = new URLSearchParams(window.location.search).get("theme")
8
+ if(themeQueryParameter && ["light", "dark"].includes(themeQueryParameter)){
9
+ return themeQueryParameter
10
+ }
7
11
  if (typeof localStorage !== 'undefined' && localStorage.getItem('COMPIIILE_THEME')) {
8
12
  return localStorage.getItem('COMPIIILE_THEME');
9
13
  }
package/README.md CHANGED
@@ -30,7 +30,7 @@ That's what Compiiile does. And it does it hassle-free !
30
30
  - [x] :mag: **Full-text quick search with content preview**
31
31
  - [x] :zap: Hot-reload content preview as you edit it
32
32
  - [x] :tada: Supports MDX files: add your own components to your documentation
33
- - [x] :bulb: Can serve as knowledge base
33
+ - [x] :bulb: Can serve as knowledge base, and handles symlinks to reuse content
34
34
  - [x] :wrench: Customizable by env variables or config file, it's up to you
35
35
  - [x] :star2: You get it, it simply does the job, period.
36
36
 
@@ -184,6 +184,8 @@ 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
 
187
+ > :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.
188
+
187
189
  ### Routing
188
190
 
189
191
  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.
package/bin/config.js CHANGED
@@ -159,6 +159,7 @@ const astroConfig = {
159
159
  vite: {
160
160
  plugins: [compiiile()],
161
161
  resolve: {
162
+ preserveSymlinks: true,
162
163
  alias: {
163
164
  "@source": source,
164
165
 
@@ -39,7 +39,7 @@ export default class {
39
39
  .map((val) => slugify(val, { lower: true }))
40
40
  .join("/")
41
41
 
42
- if (sluggifiedPath.match(entryFileMatcher)) {
42
+ if (sluggifiedPath.match(new RegExp(/^/.source + entryFileMatcher.source))) {
43
43
  if (process.env.VITE_COMPIIILE_BASE !== "/") {
44
44
  return process.env.VITE_COMPIIILE_BASE
45
45
  }
@@ -85,7 +85,7 @@ export default class {
85
85
  const fileName = path.parse(filePath).name
86
86
  const isReadmeFile =
87
87
  !isDirectory &&
88
- filePath.toLowerCase().match(new RegExp(/^/.source + entryFileMatcher.source + /\.mdx?$/.source))
88
+ filePath.toLowerCase().match(new RegExp(/^(.*?\/?)/.source + entryFileMatcher.source + /\.mdx?$/.source))
89
89
 
90
90
  let filesTreeItem = new FilesTreeItem(uuid, fileName)
91
91
 
@@ -147,7 +147,16 @@ export default class {
147
147
  )
148
148
 
149
149
  if (isReadmeFile) {
150
- this.fileList.unshift(fileListItem)
150
+ let newIndex = 0
151
+
152
+ if(directoryPath !== "."){
153
+ newIndex = this.fileList.findIndex(f => f.fullPath.startsWith(directoryPath))
154
+ if(newIndex < 0){
155
+ newIndex = this.fileList.length
156
+ }
157
+ }
158
+
159
+ this.fileList.splice(newIndex, 0, fileListItem)
151
160
  } else {
152
161
  this.fileList.push(fileListItem)
153
162
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@compiiile/compiiile",
3
3
  "private": false,
4
- "version": "2.9.2",
4
+ "version": "2.10.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",