@compiiile/compiiile 2.17.1 → 2.18.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import WorkspaceLayout from "../layouts/WorkspaceLayout.astro"
|
|
3
3
|
import ContentWrapper from "../components/ContentWrapper.vue"
|
|
4
|
-
import {routeList} from "virtual:compiiile"
|
|
4
|
+
import {routeList, site} from "virtual:compiiile"
|
|
5
5
|
import SlidesLayout from "../layouts/SlidesLayout.astro"
|
|
6
6
|
import path from "node:path"
|
|
7
7
|
|
|
@@ -31,7 +31,8 @@ export async function getStaticPaths() {
|
|
|
31
31
|
uuid: route.name,
|
|
32
32
|
title: route.meta.title,
|
|
33
33
|
description: route.meta.description || "",
|
|
34
|
-
textAlign: route.meta.textAlign
|
|
34
|
+
textAlign: route.meta.textAlign,
|
|
35
|
+
meta: route.meta
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
})
|
|
@@ -39,11 +40,13 @@ export async function getStaticPaths() {
|
|
|
39
40
|
|
|
40
41
|
let {path} = Astro.params;
|
|
41
42
|
|
|
42
|
-
const {name, title, description, asSlides, textAlign} = Astro.props
|
|
43
|
+
const {name, title, description, asSlides, textAlign, meta} = Astro.props
|
|
44
|
+
site.pageFrontmatter = meta
|
|
43
45
|
|
|
44
|
-
const {Content} = Astro.props.md
|
|
46
|
+
const {Content, getHeadings} = Astro.props.md
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
|
|
49
|
+
const tableOfContent = getHeadings()
|
|
47
50
|
---
|
|
48
51
|
|
|
49
52
|
{asSlides ?
|
package/README.md
CHANGED
|
@@ -317,11 +317,9 @@ import Test from "./Test.vue"
|
|
|
317
317
|
<Test client:load />
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
-
You should
|
|
321
|
-
use [Astro's client directives](https://docs.astro.build/en/reference/directives-reference/#client-directives) to load
|
|
322
|
-
your component's script.
|
|
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).
|
|
323
321
|
|
|
324
|
-
###
|
|
322
|
+
### Using config data values
|
|
325
323
|
|
|
326
324
|
To use config values, you can access it by importing the `site` variable in your MDX file and then access the `data`
|
|
327
325
|
key:
|
|
@@ -332,6 +330,42 @@ import { site } from "virtual:compiiile"
|
|
|
332
330
|
# {site.data.someProperty}
|
|
333
331
|
```
|
|
334
332
|
|
|
333
|
+
### Using frontmatter variables
|
|
334
|
+
|
|
335
|
+
In your MDX files, all frontmatter variables are available via the `frontmatter` variable:
|
|
336
|
+
|
|
337
|
+
```mdx
|
|
338
|
+
---
|
|
339
|
+
description: some description
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
{ frontmatter.description }
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
> :books: More info in the [dedicated Astro documentation](https://docs.astro.build/en/guides/integrations-guide/mdx/#using-frontmatter-variables-in-mdx).
|
|
346
|
+
|
|
347
|
+
In your custom components, you can access the current page's frontmatter by using the `pageFrontmatter` property from Compiiile's Vite plugin:
|
|
348
|
+
|
|
349
|
+
```vue
|
|
350
|
+
<template>
|
|
351
|
+
<p>{{ frontmatter.description }}</p>
|
|
352
|
+
</template>
|
|
353
|
+
|
|
354
|
+
<script>
|
|
355
|
+
import { site } from "virtual:compiiile"
|
|
356
|
+
|
|
357
|
+
export default {
|
|
358
|
+
name: "CustomComponent",
|
|
359
|
+
computed: {
|
|
360
|
+
frontmatter(){
|
|
361
|
+
return site.pageFrontmatter
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
</script>
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
|
|
335
369
|
## Ignoring files and folders
|
|
336
370
|
|
|
337
371
|
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.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import remarkEmoji from "remark-emoji"
|
|
2
2
|
import rehypeImagePlugin from "./rehypeImagePlugin.js"
|
|
3
3
|
import rehypeLinkPlugin from "./rehypeLinkPlugin.js"
|
|
4
4
|
import rehypeSlug from "rehype-slug"
|
|
@@ -7,7 +7,7 @@ import { h } from "hastscript"
|
|
|
7
7
|
import rehypeHandleYamlMatterPlugin from "./rehypeHandleYamlMatterPlugin.js"
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
remarkPlugins: [
|
|
10
|
+
remarkPlugins: [remarkEmoji],
|
|
11
11
|
rehypePlugins: [
|
|
12
12
|
rehypeImagePlugin,
|
|
13
13
|
rehypeLinkPlugin,
|
|
@@ -3,6 +3,9 @@ import { matter } from "vfile-matter"
|
|
|
3
3
|
export default function rehypeHandleYamlMatterPlugin() {
|
|
4
4
|
return function (_, file) {
|
|
5
5
|
matter(file)
|
|
6
|
-
file.data.astro.frontmatter =
|
|
6
|
+
file.data.astro.frontmatter = {
|
|
7
|
+
...file.data.astro.frontmatter,
|
|
8
|
+
...file.data.matter
|
|
9
|
+
}
|
|
7
10
|
}
|
|
8
11
|
}
|
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.18.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",
|