Closed julientaq closed 3 years ago
I digged a bit and i have a couple of questions.
The npm package for this plugin has only a toc.js, and the code is a bit different from the source files, and, if i try to do the following:
<aside>
{{ content | toc: '{"tags":["h2","h3"],"wrapper":"div","wrapperClass":"content-tableau"}' }}
</aside>
i get a
`TemplateWriterWriteError` was thrown
> (./src/layouts/bookindex.njk) [Line 17, Column 49]
Thanks!
It seems that there is a fork of this repo here (https://github.com/JordanShurmer/eleventy-plugin-nesting-toc) that support nesting, and that may explain where i got lost. i’m gonna close this issue, unless you want to have a look at it.
Thanks!
(i fixed it using another filter:
eleventyConfig.addFilter("prependLinks", function (value, prepend) {
return value.replace(/<a href="/g, `<a href="${prepend}`)
});
and
{{ item.templateContent | toc | prependLinks(item.url) | safe}}
in my template file
Hi there! thanks for this amazing plugin.
i’m trying to use the generated table of content on another page than the one used, is it possible to add a
preprend
to the configuration to preprend the link in the url?could then accept something along those line
where item would be a page inside a loop.
I’m gonna have a look at the code and see if that could work, but i don’t know if the question was asked before.