You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Providing an extension_registry means that the extensions are now executed twice (I suppose once from load() and another from convert()) with different options.
When coupled with asciidoctor-kroki, this means that diagrams are downloaded once next to the adoc file, then next to the HTML file.
mkdir eslint-plugin-asciidoc-pull30-repro
cd !$
npm init -y --init-type=module
npm add -D @11ty/eleventy eleventy-plugin-asciidoc @asciidoctor/core asciidoctor-kroki@1.0.0-beta.1
cat >.eleventy.js <<EOF
import eleventyAsciidoc from "eleventy-plugin-asciidoc";
import asciidoctorKroki from "asciidoctor-kroki";
import { Extensions } from "@asciidoctor/core";
function configure_extension_registry(registry) {
asciidoctorKroki.register(registry);
}
const extension_registry = Extensions.create();
configure_extension_registry(extension_registry);
export default async function (eleventyConfig) {
eleventyConfig.addPlugin(eleventyAsciidoc, {
safe: "unsafe",
// configure_extension_registry,
extension_registry,
attributes: {
"kroki-fetch-diagram": true,
},
});
eleventyConfig.addPassthroughCopy("foo/*/*");
};
EOF
mkdir -p foo/bar
cat >foo/bar.adoc <<EOF
image:baz.png[]
[mermaid]
....
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
....
EOF
# Dummy "image" file
touch foo/bar/baz.png
# track changes with Git to make it easier to reset to that state
git init
cat >.gitignore <<EOF
/node_modules/
/_site/
EOF
git add .
git commit -m "Initial state"
Now run rm -rf _site/ foo/diag-* && npx eleventy and check where the diag-*.svg files have been emitted (e.g. ls **/diag-*)
You can uncomment configure_extension_registry and comment out extension_registry to see the difference.
Putting some console.log() into node_modules/asciidoctor-kroki/src/fetch.js I saw it was called once without outdir and once with an outdir configured to _site/foo/bar. Adding a console.log() just after the load() shows the first call is from load() and the second from convert() (or at least, once before and once after that log)
Now maybe this is a bug in Asciidoctor.js that shouldn't call the extensions from load(), I'll let you judge 🤷
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.