eleventy-plugin-asciidoc 1.3.3 → 2.0.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.
package/README.md CHANGED
@@ -50,6 +50,10 @@ module.exports = function (eleventyConfig) {
50
50
  };
51
51
  ```
52
52
 
53
+ ##### `base_dir`
54
+
55
+ The `base_dir` of [convert options](https://docs.asciidoctor.org/asciidoctor.js/latest/processor/convert-options/) is relative to the document. This can be changed using above [options](#customize-with-options).
56
+
53
57
  ### CSS Styles
54
58
 
55
59
  The plugin does not include any CSS styles. It is up to you to style the content.
@@ -1,9 +1,11 @@
1
1
  // @ts-check
2
+ /* eslint camelcase: ["error", {allow: ["base_dir"]}] */
2
3
 
3
4
  const asciidoctor = require("asciidoctor").default();
4
5
  const debug = require("debug")("eleventy-plugin-asciidoc");
5
6
  const fs = require("fs");
6
7
  const matter = require("gray-matter");
8
+ const path = require("path");
7
9
  const nunjucks = require("nunjucks");
8
10
 
9
11
  /** @typedef {import('asciidoctor').Asciidoctor.ProcessorOptions} ProcessorOptions */
@@ -65,9 +67,13 @@ function eleventyAsciidoctor(convertOptions = {}) {
65
67
  debug(`Reading ${inputPath}`);
66
68
  const { content } = readFileSync(inputPath);
67
69
 
70
+ let { base_dir } = options;
71
+ base_dir = base_dir === undefined ? path.dirname(inputPath) : base_dir;
72
+
68
73
  if (content) {
69
74
  debug(`Converting:\n ${content}`);
70
- return asciidoctor.convert(content, options);
75
+ debug(`base_dir: ${base_dir}`);
76
+ return asciidoctor.convert(content, { ...options, base_dir });
71
77
  }
72
78
  };
73
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleventy-plugin-asciidoc",
3
- "version": "1.3.3",
3
+ "version": "2.0.0",
4
4
  "description": "Adds support for AsciiDoc to Eleventy",
5
5
  "main": ".eleventy.js",
6
6
  "repository": {
@@ -22,21 +22,21 @@
22
22
  "author": "Saneef Ansari <hello@saneef.com> (https://saneef.com/)",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "asciidoctor": "^2.2.5",
26
- "debug": "^4.3.2",
25
+ "asciidoctor": "^2.2.6",
26
+ "debug": "^4.3.4",
27
27
  "gray-matter": "^4.0.3",
28
28
  "nunjucks": "^3.2.3"
29
29
  },
30
30
  "devDependencies": {
31
31
  "ava": "^3.15.0",
32
- "eslint": "^8.0.1",
33
- "eslint-config-prettier": "^8.3.0",
34
- "eslint-config-xo-space": "^0.30.0",
35
- "eslint-plugin-prettier": "^4.0.0",
36
- "husky": "^7.0.2",
37
- "lint-staged": "^11.2.3",
32
+ "eslint": "^8.25.0",
33
+ "eslint-config-prettier": "^8.5.0",
34
+ "eslint-config-xo-space": "^0.33.0",
35
+ "eslint-plugin-prettier": "^4.2.1",
36
+ "husky": "^8.0.1",
37
+ "lint-staged": "^13.0.3",
38
38
  "nyc": "^15.1.0",
39
- "prettier": "^2.4.1",
39
+ "prettier": "^2.7.1",
40
40
  "rimraf": "^3.0.2"
41
41
  },
42
42
  "lint-staged": {