Giter VIP home page Giter VIP logo

Comments (5)

jdsteinbach avatar jdsteinbach commented on June 15, 2024

Sorry for the (inexcusably) late reply; I'll test this out. Can you provide any other info about this particular Eleventy config?

  • What template option are you using?
  • Can you provide an example of the stringified JSON option object you're passing in?

from eleventy-plugin-toc.

helmutgranda avatar helmutgranda commented on June 15, 2024

In my case I have tried two ways and options are not being uptaken by the plugin, they are just being ignored. I was to use UL instead of OL:

const tocOptions = {
  
    tags: ['h2', 'h3', 'h4'], // which heading tags are selected
    wrapper: 'nav',           // element to put around the root `ol`
    wrapperClass: 'toc-abc',       // class for the element around the root `ol`
    ul: true,
    flat: true, 
  
}

module.exports = function(eleventyConfig) {

  //Plugins
  eleventyConfig.setLibrary(
    'md',
    markdownIt(mdOptions)
      .use(markdownItAnchor, mdAnchorOpts)
  )
  
  //eleventyConfig.addPlugin(pluginTOC,tocOptions);

  eleventyConfig.addPlugin(pluginTOC, {
      tags: ['h2', 'h3', 'h4'], // which heading tags are selected
      wrapper: 'nav',           // element to put around the root `ol`
      wrapperClass: 'toc-abc',       // class for the element around the root `ol`
      ul: true,
      flat: false, 
  });

from eleventy-plugin-toc.

jdsteinbach avatar jdsteinbach commented on June 15, 2024

@helmutgranda Just published 1.1.0 which supports .eleventy.js options in addPlugin

from eleventy-plugin-toc.

jdsteinbach avatar jdsteinbach commented on June 15, 2024

@Heydon Recent updates also fixed an issue with JSON options in templates. If you're still using this plugin, can you update the version and see if that works for you? Thanks!

from eleventy-plugin-toc.

jdsteinbach avatar jdsteinbach commented on June 15, 2024

This issue is >1y old and should be resolved by prior work. However, if anyone is still having this issue, I'll give a week to comment, then close. Thanks!

from eleventy-plugin-toc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.