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 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 `1.0.0` or newer.**
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 file are made available in `page.asciidocAttributes`.
14
- - Example `:author: Jane Doe` in the `.adoc` file will be available in `page.asciidocAttrbutes.author`
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
- showtitle: true /* Default value: true */,
45
+ attributes: {
46
+ showtitle: true /* Default value: undefined */,
47
+ },
46
48
  safe: "unsafe" /* Default value: undefined */,
47
49
  });
48
50
  };
@@ -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 = (str) => (data) => {
58
- if (str) {
59
- // Since `read: false` is set 11ty doesn't read file contents
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.2.0",
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
- "responsive-images",
17
- "images",
16
+ "asciidoc",
17
+ "asciidoctor",
18
18
  "eleventy",
19
19
  "11ty",
20
20
  "eleventy-plugin"