eleventy-plugin-asciidoc 1.2.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 +14 -2
- package/lib/eleventy-asciidoc.js +5 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ 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
|
|
|
@@ -42,8 +42,20 @@ 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
|
};
|
|
49
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
|
@@ -50,21 +50,20 @@ function eleventyAsciidoctor(convertOptions = {}) {
|
|
|
50
50
|
debug("Converter options: ", convertOptions);
|
|
51
51
|
|
|
52
52
|
const options = {
|
|
53
|
-
showtitle: true,
|
|
54
53
|
...convertOptions,
|
|
55
54
|
};
|
|
56
55
|
|
|
57
|
-
const compile = (str) => (data) => {
|
|
56
|
+
const compile = (str, inputPath) => (data) => {
|
|
58
57
|
if (str) {
|
|
59
|
-
//
|
|
60
|
-
|
|
58
|
+
// So if str has a value, it's a permalink (which can be a string or a function)
|
|
59
|
+
debug(`Permalink: ${str}`);
|
|
61
60
|
return typeof str === "function"
|
|
62
61
|
? str(data)
|
|
63
62
|
: nunjucks.renderString(str, data);
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
debug(`Reading ${
|
|
67
|
-
const { content } = readFileSync(
|
|
65
|
+
debug(`Reading ${inputPath}`);
|
|
66
|
+
const { content } = readFileSync(inputPath);
|
|
68
67
|
|
|
69
68
|
if (content) {
|
|
70
69
|
debug(`Converting:\n ${content}`);
|