@compiiile/compiiile 2.6.0 → 2.7.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.
@@ -205,6 +205,9 @@
205
205
  padding: 0;
206
206
  border-collapse: collapse;
207
207
  margin-bottom: 20px;
208
+ display: block;
209
+ max-width: 100%;
210
+ overflow-x: scroll;
208
211
  }
209
212
 
210
213
  table tr {
@@ -111,7 +111,11 @@
111
111
 
112
112
  table {
113
113
  font-size: 2vmin;
114
+ display: block;
115
+ max-width: 100%;
116
+ overflow-x: scroll;
114
117
  }
118
+
115
119
  table tr {
116
120
  border: 1px solid var(--table-border-color);
117
121
  background-color: var(--table-odd-lines-background-color);
@@ -172,3 +176,17 @@ html.theme--light td code {
172
176
  html.reveal-print .reveal .slides section {
173
177
  padding: var(--slide-padding-vertical) var(--slide-padding-horizontal) !important;
174
178
  }
179
+
180
+ @media screen and (max-width: 1400px) {
181
+ :root {
182
+ --slide-padding-vertical: 20px;
183
+ --slide-padding-horizontal: 40px;
184
+ }
185
+ }
186
+
187
+ @media screen and (max-width: 800px) {
188
+ :root {
189
+ --slide-padding-vertical: 20px;
190
+ --slide-padding-horizontal: 10px;
191
+ }
192
+ }
package/README.md CHANGED
@@ -162,18 +162,19 @@ The home page of Compiiile (`/`) points to a `README.md` file located at the roo
162
162
 
163
163
  Here is the list of parameters that you can set to customize Compiiile (none are required):
164
164
 
165
- | Parameter | Type | Description |
166
- | ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------- |
167
- | `title` | `string` | The title to display on the top-left of the User Interface |
168
- | `description` | `string` | The description that is rendered by default for the SEO |
169
- | `logo` | `string` | The relative path of the logo to display in the TopBar and as favicon |
170
- | `logoUrl` | `string` | The url to go to when clicking on the logo, defaults to the home page if not set |
171
- | `dest` | `string` | The folder in which to build files, defaults to `./.compiiile/dist` |
172
- | `siteUrl` | `string` | The url of the website in production (without trailing slash), used for the SEO tag `og:image` |
173
- | `astroConfig` | `Object` | Override [default Astro config](https://docs.astro.build/en/reference/configuration-reference/) |
174
- | `data` | `Object` | An object with data to use in MDX files (check use case below) |
175
- | `theme` | `string` | The website theme, value can be : `auto` (default value: adapts to system preferences) \| `light` \| `dark` |
176
- | `vite.server.fs.allow` | `string[]` | Add local paths to vite's server fs allow list |
165
+ | Parameter | Type | Description |
166
+ | ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------- |
167
+ | `title` | `string` | The title to display on the top-left of the User Interface |
168
+ | `description` | `string` | The description that is rendered by default for the SEO |
169
+ | `logo` | `string` | The relative path of the logo to display in the TopBar and as favicon |
170
+ | `logoUrl` | `string` | The url to go to when clicking on the logo, defaults to the home page if not set |
171
+ | `dest` | `string` | The folder in which to build files, defaults to `./.compiiile/dist` |
172
+ | `siteUrl` | `string` | The url of the website in production (without trailing slash), used for the SEO tag `og:image` |
173
+ | `astroConfig` | `Object` | Override [default Astro config](https://docs.astro.build/en/reference/configuration-reference/) |
174
+ | `data` | `Object` | An object with data to use in MDX files (check use case below) |
175
+ | `theme` | `string` | The website theme, value can be : `auto` (default value: adapts to system preferences) \| `light` \| `dark` |
176
+ | `useAutoTitles` | `Boolean` | If set to `true`, use the first file heading as title to be displayed in the navbar and for SEO. Defaults to `false` |
177
+ | `vite.server.fs.allow` | `string[]` | Add local paths to vite's server fs allow list |
177
178
 
178
179
  You can use these parameters in 2 ways:
179
180
 
package/bin/config.js CHANGED
@@ -53,6 +53,7 @@ process.env.VITE_COMPIIILE_LOGO_URL = argv.logoUrl ?? ""
53
53
  process.env.VITE_COMPIIILE_THEME = argv.theme ?? "auto"
54
54
 
55
55
  process.env.VITE_COMPIIILE_DATA = JSON.stringify(argv.data ?? {})
56
+ process.env.VITE_COMPIIILE_USE_AUTO_TITLES = /true/i.test(argv.useAutoTitles) // defaults to `false` if not set or not equal to `true`
56
57
 
57
58
  // Handling logo and favicon
58
59
  process.env.VITE_COMPIIILE_LOGO = null
@@ -83,8 +83,9 @@ export default class {
83
83
  const isDirectory = fs.statSync(filePath).isDirectory()
84
84
  const uuid = uuidv4()
85
85
  const fileName = path.parse(filePath).name
86
- const isReadmeFile = !isDirectory
87
- && filePath.toLowerCase().match(new RegExp(/^/.source + entryFileMatcher.source + /\.mdx?$/.source))
86
+ const isReadmeFile =
87
+ !isDirectory &&
88
+ filePath.toLowerCase().match(new RegExp(/^/.source + entryFileMatcher.source + /\.mdx?$/.source))
88
89
 
89
90
  let filesTreeItem = new FilesTreeItem(uuid, fileName)
90
91
 
@@ -119,12 +120,31 @@ export default class {
119
120
 
120
121
  const meta = renderedMarkdown.metadata.frontmatter
121
122
 
122
- fileListItem.title = meta.title || fileName
123
+ let firstHeading = null
124
+ if (
125
+ JSON.parse(process.env.VITE_COMPIIILE_USE_AUTO_TITLES) &&
126
+ renderedMarkdown.metadata.headings.length > 0
127
+ ) {
128
+ let firstHeadingIndex = 0
129
+ if (Object.keys(renderedMarkdown.metadata.frontmatter).length > 0) {
130
+ // If a frontmatter is set, it is present as the first index in the `headings` array
131
+ firstHeadingIndex = 1
132
+ }
133
+ // Remove the starting '#' from the title
134
+ firstHeading = renderedMarkdown.metadata.headings[firstHeadingIndex]?.text?.slice(1)
135
+ }
136
+
137
+ fileListItem.title = meta.title || firstHeading || fileName
123
138
  fileListItem.meta = meta
124
139
  fileListItem.meta.title = fileListItem.meta.title || fileListItem.title
125
140
  fileListItem.fullPath = filePath
126
141
 
127
- const routePath = this.generateRoutePathFromFilePath(filePath, "", fileListItem.meta.asSlides, entryFileMatcher)
142
+ const routePath = this.generateRoutePathFromFilePath(
143
+ filePath,
144
+ "",
145
+ fileListItem.meta.asSlides,
146
+ entryFileMatcher
147
+ )
128
148
 
129
149
  if (isReadmeFile) {
130
150
  this.fileList.unshift(fileListItem)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@compiiile/compiiile",
3
3
  "private": false,
4
- "version": "2.6.0",
4
+ "version": "2.7.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",