eleventy-plugin-asciidoc 1.3.1 → 1.3.2
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 +10 -0
- package/lib/eleventy-asciidoc.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,3 +49,13 @@ module.exports = function (eleventyConfig) {
|
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
```
|
|
52
|
+
|
|
53
|
+
### CSS Styles
|
|
54
|
+
|
|
55
|
+
The plugin does not include any CSS styles. It is up to you to style the content.
|
|
56
|
+
|
|
57
|
+
The quick way to style the content is to use the CSS file from Asciidoctor.js. The CSS file is [available on cdnjs](https://cdnjs.com/libraries/asciidoctor.js).
|
|
58
|
+
|
|
59
|
+
## Enhancements
|
|
60
|
+
|
|
61
|
+
- [Tutorial on adding syntax highlighting](https://saneef.com/tutorials/asciidoc-syntax-highlighting/)
|
package/lib/eleventy-asciidoc.js
CHANGED
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
|
|
8
9
|
/** @typedef {import('asciidoctor').Asciidoctor.ProcessorOptions} ProcessorOptions */
|
|
9
10
|
/** @typedef {import('gray-matter').GrayMatterFile} GrayMatterFile */
|
|
@@ -52,7 +53,15 @@ function eleventyAsciidoctor(convertOptions = {}) {
|
|
|
52
53
|
...convertOptions,
|
|
53
54
|
};
|
|
54
55
|
|
|
55
|
-
const compile = (
|
|
56
|
+
const compile = (str, inputPath) => (data) => {
|
|
57
|
+
if (str) {
|
|
58
|
+
// So if str has a value, it's a permalink (which can be a string or a function)
|
|
59
|
+
debug(`Permalink: ${str}`);
|
|
60
|
+
return typeof str === "function"
|
|
61
|
+
? str(data)
|
|
62
|
+
: nunjucks.renderString(str, data);
|
|
63
|
+
}
|
|
64
|
+
|
|
56
65
|
debug(`Reading ${inputPath}`);
|
|
57
66
|
const { content } = readFileSync(inputPath);
|
|
58
67
|
|