eleventy-plugin-asciidoc 5.0.0 → 5.0.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/README.md +20 -2
- package/lib/eleventy-asciidoc.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,8 +41,7 @@ You can use either [Eleventy style front matter](https://www.11ty.dev/docs/data-
|
|
|
41
41
|
|
|
42
42
|
Any AsciiDoc document attributes that are prefixed with `eleventy-` ([configurable](#eleventyAttributesPrefix)) can be used as front matter. _The prefix, `eleventy-`, will be removed from variable names available in the templates._
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
> Only document-scoped attributes or variables can be used for front matter. Attributes that are written after the document title (`= Document Title`) will not be considered for front matter.
|
|
44
|
+
Only document-scoped attributes or variables can be used for front matter. Attributes that are written after the document title (`= Document Title`) will not be considered for front matter.
|
|
46
45
|
|
|
47
46
|
```adoc
|
|
48
47
|
:eleventy-permalink: /hello-world/
|
|
@@ -69,6 +68,25 @@ Hello everyone!
|
|
|
69
68
|
> [!WARNING]
|
|
70
69
|
> Asciidoctor.js converts all attribute names to lower case letters. Example `:eleventy-aTitle:` will be made available as `atitle` in front matter data (also as `eleventy-atitle` in document attributes).
|
|
71
70
|
|
|
71
|
+
#### Data Cascade
|
|
72
|
+
|
|
73
|
+
Data specified using AsciiDoc style front matter override YAML (or front matter in other Eleventy supported formats).
|
|
74
|
+
|
|
75
|
+
```adoc
|
|
76
|
+
---
|
|
77
|
+
layout: layout-a.njk
|
|
78
|
+
---
|
|
79
|
+
:eleventy-layout: layout-b.njk
|
|
80
|
+
|
|
81
|
+
= Hello World
|
|
82
|
+
|
|
83
|
+
Hello everyone!
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
In the above case, front matter data will have `{ layout: layout-b.njk }`.
|
|
87
|
+
|
|
88
|
+
In the case of `title`, [the AsciiDoc document title](https://docs.asciidoctor.org/asciidoc/latest/document/title/) (including `title` and `doctitle` attributes) takes precedence over front matter.
|
|
89
|
+
|
|
72
90
|
### Customize with Options
|
|
73
91
|
|
|
74
92
|
You can pass options to `convert()` of Asciidoctor.js as second argument in `addPlugin()`.
|
package/lib/eleventy-asciidoc.js
CHANGED
|
@@ -67,9 +67,11 @@ const generateGetDataFromInputPath = (converterOptions) => (inputPath) => {
|
|
|
67
67
|
debug(`Document Eleventy attributes: ${JSON.stringify(eleventyAttributes)}`);
|
|
68
68
|
|
|
69
69
|
let data = {
|
|
70
|
-
title,
|
|
71
70
|
asciidocAttributes: attributes,
|
|
72
71
|
...eleventyAttributes,
|
|
72
|
+
// Pass title only if defined. Otherwise, `undefined`
|
|
73
|
+
// will override the title in `eleventyAttributes`
|
|
74
|
+
...(title === undefined ? {} : { title }),
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
// Removes undefined values
|