@compiiile/compiiile 2.3.1 → 2.4.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.
- package/.compiiile/src/components/SlidesContent.vue +13 -2
- package/.compiiile/src/layouts/SlidesLayout.astro +2 -2
- package/.compiiile/src/pages/[...path].astro +4 -3
- package/.compiiile/src/style/slides.scss +56 -8
- package/README.md +22 -2
- package/bin/config.js +2 -0
- package/bin/vitePluginCompiiile/models/Context.js +7 -1
- package/index.md +1 -0
- package/package.json +1 -1
- package/slides-preview.mdx +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="slidesDeckWrapper" class="slides-deck-wrapper">
|
|
2
|
+
<div ref="slidesDeckWrapper" :class="['slides-deck-wrapper', `text-align-${textAlign}`]" :style="{ textAlign }">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
<script>
|
|
8
8
|
export default {
|
|
9
9
|
name: "SlidesContent",
|
|
10
|
+
props: {
|
|
11
|
+
textAlign: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: "center"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
10
16
|
data() {
|
|
11
17
|
return {
|
|
12
18
|
loaded: false
|
|
@@ -24,7 +30,12 @@
|
|
|
24
30
|
|
|
25
31
|
const Reveal = (await import("reveal.js")).default(deck, {
|
|
26
32
|
embedded: true,
|
|
27
|
-
pdfMaxPagesPerSlide: 1
|
|
33
|
+
pdfMaxPagesPerSlide: 1,
|
|
34
|
+
width: "100%",
|
|
35
|
+
height: "100%",
|
|
36
|
+
margin: 0,
|
|
37
|
+
minScale: 1,
|
|
38
|
+
maxScale: 1
|
|
28
39
|
})
|
|
29
40
|
|
|
30
41
|
await Reveal.initialize({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
import SlidesContent from "../components/SlidesContent.vue";
|
|
3
3
|
import BaseLayout from "./BaseLayout.astro";
|
|
4
|
-
const { title, description } = Astro.props
|
|
4
|
+
const { title, description, textAlign } = Astro.props
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<BaseLayout title={ title } description={ description } isNotFoundPage={ false }>
|
|
8
|
-
<SlidesContent client:load>
|
|
8
|
+
<SlidesContent client:load textAlign={textAlign}>
|
|
9
9
|
<slot></slot>
|
|
10
10
|
</SlidesContent>
|
|
11
11
|
</BaseLayout>
|
|
@@ -26,7 +26,8 @@ export async function getStaticPaths() {
|
|
|
26
26
|
asSlides: !!route.meta.asSlides,
|
|
27
27
|
uuid: route.name,
|
|
28
28
|
title: route.meta.title,
|
|
29
|
-
description: route.meta.description || ""
|
|
29
|
+
description: route.meta.description || "",
|
|
30
|
+
textAlign: route.meta.textAlign
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
})
|
|
@@ -34,7 +35,7 @@ export async function getStaticPaths() {
|
|
|
34
35
|
|
|
35
36
|
let {path} = Astro.params;
|
|
36
37
|
|
|
37
|
-
const {name, title, description, asSlides} = Astro.props
|
|
38
|
+
const {name, title, description, asSlides, textAlign} = Astro.props
|
|
38
39
|
|
|
39
40
|
const {Content} = Astro.props.md
|
|
40
41
|
|
|
@@ -42,7 +43,7 @@ const tableOfContent = Astro.props.md.getHeadings()
|
|
|
42
43
|
---
|
|
43
44
|
|
|
44
45
|
{asSlides ?
|
|
45
|
-
<SlidesLayout title={title} description={description}>
|
|
46
|
+
<SlidesLayout title={title} description={description} textAlign={textAlign}>
|
|
46
47
|
<div class="slides-content">
|
|
47
48
|
<Content/>
|
|
48
49
|
</div>
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--r-code-font: "JetBrains Mono Variable", monospace;
|
|
3
|
+
--slide-padding-vertical: 40px;
|
|
4
|
+
--slide-padding-horizontal: 80px;
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
.reveal {
|
|
6
8
|
height: 100vh;
|
|
7
9
|
width: 100vw;
|
|
8
10
|
|
|
11
|
+
.slides {
|
|
12
|
+
text-align: inherit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
section {
|
|
16
|
+
padding: var(--slide-padding-vertical) var(--slide-padding-horizontal);
|
|
17
|
+
}
|
|
18
|
+
|
|
9
19
|
pre code {
|
|
10
20
|
padding: 20px !important;
|
|
11
21
|
border-radius: 8px;
|
|
12
22
|
max-height: 80vh !important;
|
|
13
23
|
}
|
|
14
24
|
|
|
25
|
+
pre {
|
|
26
|
+
width: 100%;
|
|
27
|
+
margin: 0 auto;
|
|
28
|
+
max-width: 1200px;
|
|
29
|
+
}
|
|
30
|
+
|
|
15
31
|
h1,
|
|
16
32
|
h2,
|
|
17
33
|
h3,
|
|
@@ -23,26 +39,35 @@
|
|
|
23
39
|
"wght" 900,
|
|
24
40
|
"wdth" 125;
|
|
25
41
|
letter-spacing: -0.03em;
|
|
26
|
-
font-size:
|
|
42
|
+
font-size: 3.75vmin;
|
|
27
43
|
border: none !important;
|
|
44
|
+
margin-bottom: 4vmin;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
h1 {
|
|
48
|
+
font-size: 12vmin;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
h2 {
|
|
52
|
+
font-size: 6vmin;
|
|
28
53
|
}
|
|
29
54
|
|
|
30
55
|
font-family: "DM Sans Variable", sans-serif !important;
|
|
31
56
|
|
|
32
57
|
p,
|
|
33
58
|
li {
|
|
34
|
-
font-size:
|
|
59
|
+
font-size: max(3.25vmin, 18px) !important;
|
|
35
60
|
}
|
|
36
61
|
|
|
37
62
|
.hljs {
|
|
38
|
-
font-size:
|
|
63
|
+
font-size: 2vmin !important;
|
|
39
64
|
}
|
|
40
65
|
|
|
41
66
|
p code {
|
|
42
67
|
background-color: var(--layout-background-color);
|
|
43
68
|
padding: 2px 4px;
|
|
44
69
|
border-radius: 3px;
|
|
45
|
-
font-size:
|
|
70
|
+
font-size: 2vmin;
|
|
46
71
|
}
|
|
47
72
|
|
|
48
73
|
blockquote {
|
|
@@ -50,14 +75,18 @@
|
|
|
50
75
|
border: solid 1px var(--blockquote-border-color);
|
|
51
76
|
border-radius: 8px;
|
|
52
77
|
padding: 0.5em 1em;
|
|
78
|
+
width: 100%;
|
|
79
|
+
font-style: normal;
|
|
80
|
+
max-width: 1200px;
|
|
81
|
+
margin: 0 auto;
|
|
53
82
|
}
|
|
54
83
|
|
|
55
|
-
|
|
56
|
-
|
|
84
|
+
ul {
|
|
85
|
+
margin-left: 0;
|
|
57
86
|
}
|
|
58
87
|
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
.header-anchor {
|
|
89
|
+
display: none;
|
|
61
90
|
}
|
|
62
91
|
|
|
63
92
|
.slides a {
|
|
@@ -81,3 +110,22 @@
|
|
|
81
110
|
.reveal .progress {
|
|
82
111
|
color: var(--slides-controls) !important;
|
|
83
112
|
}
|
|
113
|
+
|
|
114
|
+
.slides-deck-wrapper.text-align-left {
|
|
115
|
+
blockquote,
|
|
116
|
+
pre {
|
|
117
|
+
margin: 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.slides-deck-wrapper.text-align-right {
|
|
122
|
+
blockquote,
|
|
123
|
+
pre {
|
|
124
|
+
margin-left: auto;
|
|
125
|
+
margin-right: 0;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
html.reveal-print .reveal .slides section {
|
|
130
|
+
padding: var(--slide-padding-vertical) var(--slide-padding-horizontal) !important;
|
|
131
|
+
}
|
package/README.md
CHANGED
|
@@ -134,10 +134,11 @@ To separate your slides, just separate the content of your markdown with:
|
|
|
134
134
|
|
|
135
135
|
:star2: You can make your slides print-ready by adding the `print-pdf` query parameter to your page, like: `https://compiiile.me/s/slides-preview?print-pdf`.
|
|
136
136
|
|
|
137
|
-
Other frontmatter keys
|
|
137
|
+
Other frontmatter keys are handled:
|
|
138
138
|
|
|
139
139
|
- `title`: set the title to be displayed in the navbar and for SEO
|
|
140
140
|
- `description`: set the description for SEO
|
|
141
|
+
- `textAlign`: possible values are [CSS text-align values](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align) (`left`, `center`, ...). This changes the default text alignment in slides. The default value is `center`.
|
|
141
142
|
|
|
142
143
|
### Routing
|
|
143
144
|
|
|
@@ -156,6 +157,7 @@ Here is the list of parameters that you can set to customize Compiiile (none are
|
|
|
156
157
|
| `dest` | `string` | The folder in which to build files, defaults to `./.compiiile/dist` |
|
|
157
158
|
| `siteUrl` | `string` | The url of the website in production (without trailing slash), used for the SEO tag `og:image` |
|
|
158
159
|
| `astroConfig` | `Object` | Override [default Astro config](https://docs.astro.build/en/reference/configuration-reference/) |
|
|
160
|
+
| `data` | `Object` | An object with data to use in MDX files (check use case below) |
|
|
159
161
|
| `vite.server.fs.allow` | `string[]` | Add local paths to vite's server fs allow list |
|
|
160
162
|
|
|
161
163
|
You can use these parameters in 2 ways:
|
|
@@ -193,6 +195,8 @@ v2 of Compiiile allows you to use MDX files with Vue components.
|
|
|
193
195
|
|
|
194
196
|
For it to work, you should install some dependencies in your project folder: `yarn add vue astro fzf` (or `npm install vue astro fzf`).
|
|
195
197
|
|
|
198
|
+
### Using components
|
|
199
|
+
|
|
196
200
|
Let's say we have Vue a component `Test.vue` making an API request and listing results:
|
|
197
201
|
|
|
198
202
|
```vue
|
|
@@ -236,7 +240,7 @@ Let's say we have Vue a component `Test.vue` making an API request and listing r
|
|
|
236
240
|
|
|
237
241
|
You can use it your MDX file like so:
|
|
238
242
|
|
|
239
|
-
```
|
|
243
|
+
```mdx
|
|
240
244
|
import Test from "./Test.vue"
|
|
241
245
|
|
|
242
246
|
<Test client:load />
|
|
@@ -244,6 +248,16 @@ import Test from "./Test.vue"
|
|
|
244
248
|
|
|
245
249
|
You should use [Astro's client directives](https://docs.astro.build/en/reference/directives-reference/#client-directives) to load your component's script.
|
|
246
250
|
|
|
251
|
+
### Use config data values
|
|
252
|
+
|
|
253
|
+
To use config values, you can access it by importing the `site` variable in your MDX file and then access the `data` key:
|
|
254
|
+
|
|
255
|
+
```mdx
|
|
256
|
+
import { site } from "virtual:compiiile"
|
|
257
|
+
|
|
258
|
+
# {site.data.someProperty}
|
|
259
|
+
```
|
|
260
|
+
|
|
247
261
|
## Common issues
|
|
248
262
|
|
|
249
263
|
- Make sure that the absolute path to the folder where you are running Compiiile doesn't contain any special character as it could prevent the project initialization.
|
|
@@ -261,6 +275,12 @@ Contributions are welcome after discussing the object of your contribution in th
|
|
|
261
275
|
|
|
262
276
|
You can read more about it and the roadmap in the [dedicated contributing guide](./CONTRIBUTING.md).
|
|
263
277
|
|
|
278
|
+
## Community projects
|
|
279
|
+
|
|
280
|
+
Here is a list of projects related to Compiiile developed by the community:
|
|
281
|
+
|
|
282
|
+
- [compiiile-actions-cloudflare-pages](https://github.com/marketplace/actions/compiiile-cloudflare-pages): A simple GitHub action to deploy a Compiiile site to CloudFlare pages
|
|
283
|
+
|
|
264
284
|
## Support
|
|
265
285
|
|
|
266
286
|
Open-source is a wonderful thing, so please if you found this project useful or use it as a part of a commercial project, **consider making a donation**.
|
package/bin/config.js
CHANGED
|
@@ -50,6 +50,8 @@ process.env.VITE_COMPIIILE_DESCRIPTION = argv.description ?? ""
|
|
|
50
50
|
|
|
51
51
|
process.env.VITE_COMPIIILE_LOGO_URL = argv.logoUrl ?? ""
|
|
52
52
|
|
|
53
|
+
process.env.VITE_COMPIIILE_DATA = JSON.stringify(argv.data ?? {})
|
|
54
|
+
|
|
53
55
|
// Handling logo and favicon
|
|
54
56
|
process.env.VITE_COMPIIILE_LOGO = null
|
|
55
57
|
|
|
@@ -26,7 +26,8 @@ export default class {
|
|
|
26
26
|
logo: process.env.VITE_COMPIIILE_LOGO !== "null" ? process.env.VITE_COMPIIILE_LOGO : undefined,
|
|
27
27
|
logoUrl: process.env.VITE_COMPIIILE_LOGO_URL !== "" ? process.env.VITE_COMPIIILE_LOGO_URL : undefined,
|
|
28
28
|
siteUrl: process.env.VITE_COMPIIILE_SITE_URL !== "" ? process.env.VITE_COMPIIILE_SITE_URL : undefined,
|
|
29
|
-
base: process.env.VITE_COMPIIILE_BASE
|
|
29
|
+
base: process.env.VITE_COMPIIILE_BASE,
|
|
30
|
+
data: JSON.parse(process.env.VITE_COMPIIILE_DATA)
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -106,10 +107,15 @@ export default class {
|
|
|
106
107
|
|
|
107
108
|
fileListItem.textContent = unemojify(
|
|
108
109
|
renderedMarkdown.code
|
|
110
|
+
.replace(/^<hr>\n<h2(.|\n)*?<\/h2>/g, "")
|
|
111
|
+
.replace(/<br>/g, " ")
|
|
109
112
|
.replace(/<a.*aria-hidden.*>.*?<\/a>|<[^>]*>?/gi, "")
|
|
110
113
|
.replace(/[\r\n]{2,}/g, "\n")
|
|
111
114
|
)
|
|
115
|
+
|
|
112
116
|
const meta = renderedMarkdown.metadata.frontmatter
|
|
117
|
+
|
|
118
|
+
|
|
113
119
|
fileListItem.title = meta.title || fileName
|
|
114
120
|
fileListItem.meta = meta
|
|
115
121
|
fileListItem.meta.title = fileListItem.meta.title || fileListItem.title
|
package/index.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Index
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compiiile/compiiile",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.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",
|