eleventy-plugin-asciidoc 1.2.0 → 1.3.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 +6 -4
- package/lib/eleventy-asciidoc.js +3 -13
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,14 +4,14 @@ Eleventy plugin to add support for [AsciiDoc](https://asciidoc.org/). You don't
|
|
|
4
4
|
|
|
5
5
|
The plugin uses [Asciidoctor.js](https://docs.asciidoctor.org/asciidoctor.js) under the hood.
|
|
6
6
|
|
|
7
|
-
**Requires Eleventy
|
|
7
|
+
**Requires Eleventy 1.0.0-beta.10, 1.0.0-canary.50 or newer.**
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
11
|
- Supports the default [YAML front matter](https://www.11ty.dev/docs/data-frontmatter/).
|
|
12
12
|
- Supports [AsciiDoc document title](https://docs.asciidoctor.org/asciidoc/latest/document/title/#title-syntax)
|
|
13
|
-
- Other attributes in the AsciiDoc
|
|
14
|
-
- Example `:author: Jane Doe` in the `.adoc` file will be available
|
|
13
|
+
- Other attributes in the AsciiDoc files are made available through `page.asciidocAttributes`.
|
|
14
|
+
- Example `:author: Jane Doe` in the `.adoc` file will be available as `page.asciidocAttrbutes.author`
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
17
17
|
|
|
@@ -42,7 +42,9 @@ const eleventyAsciidoc = require("eleventy-plugin-asciidoc");
|
|
|
42
42
|
|
|
43
43
|
module.exports = function (eleventyConfig) {
|
|
44
44
|
eleventyConfig.addPlugin(eleventyAsciidoc, {
|
|
45
|
-
|
|
45
|
+
attributes: {
|
|
46
|
+
showtitle: true /* Default value: undefined */,
|
|
47
|
+
},
|
|
46
48
|
safe: "unsafe" /* Default value: undefined */,
|
|
47
49
|
});
|
|
48
50
|
};
|
package/lib/eleventy-asciidoc.js
CHANGED
|
@@ -4,7 +4,6 @@ const asciidoctor = require("asciidoctor").default();
|
|
|
4
4
|
const debug = require("debug")("eleventy-plugin-asciidoc");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const matter = require("gray-matter");
|
|
7
|
-
const nunjucks = require("nunjucks");
|
|
8
7
|
|
|
9
8
|
/** @typedef {import('asciidoctor').Asciidoctor.ProcessorOptions} ProcessorOptions */
|
|
10
9
|
/** @typedef {import('gray-matter').GrayMatterFile} GrayMatterFile */
|
|
@@ -50,21 +49,12 @@ function eleventyAsciidoctor(convertOptions = {}) {
|
|
|
50
49
|
debug("Converter options: ", convertOptions);
|
|
51
50
|
|
|
52
51
|
const options = {
|
|
53
|
-
showtitle: true,
|
|
54
52
|
...convertOptions,
|
|
55
53
|
};
|
|
56
54
|
|
|
57
|
-
const compile = (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// so if str has a value, it's a permalink (which can be a string or a function)
|
|
61
|
-
return typeof str === "function"
|
|
62
|
-
? str(data)
|
|
63
|
-
: nunjucks.renderString(str, data);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
debug(`Reading ${data.page.inputPath}`);
|
|
67
|
-
const { content } = readFileSync(data.page.inputPath);
|
|
55
|
+
const compile = (_, inputPath) => () => {
|
|
56
|
+
debug(`Reading ${inputPath}`);
|
|
57
|
+
const { content } = readFileSync(inputPath);
|
|
68
58
|
|
|
69
59
|
if (content) {
|
|
70
60
|
debug(`Converting:\n ${content}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eleventy-plugin-asciidoc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Adds support for AsciiDoc to Eleventy",
|
|
5
5
|
"main": ".eleventy.js",
|
|
6
6
|
"repository": {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"prepare": "husky install"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"asciidoc",
|
|
17
|
+
"asciidoctor",
|
|
18
18
|
"eleventy",
|
|
19
19
|
"11ty",
|
|
20
20
|
"eleventy-plugin"
|