Code Monkey home page Code Monkey logo

eleventy-plugin-nesting-toc's People

Contributors

jdsteinbach avatar jonuk avatar jordanshurmer avatar pdehaan avatar princesseuh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eleventy-plugin-nesting-toc's Issues

Support usage in a content template

Background

This comes from an issue in the upstream fork:

jdsteinbach#21

Problem

Apparently, in certain situations the content is not coming through as String. The error that gets thrown is:

`Error` was thrown:
    Error: cheerio.load() expects a string

The crux of the problem, in the words of @netmikey

I found out that this happens when you try to use content on a content template itself. I guess you have to use this outside the content, e.g. on the layout template.

Solution

Need to find out what kind of object content is when used in a content file. Then turn it into the expected string (if possible) before passing it to cheerio.

markdown-it-anchor permalinks get included in links titles

When enabling markdown-it-anchor's permalinks (so permalinks are added next to titles), this plugin includes them in the toc (which is in most case, not desired)

It leads to results like this:
image

This didn't happen with eleventy-plugin-toc, the upstream version. In the upstream version, a simple hardcoded replace just removed the anchors, see here. This work for my specific use case of having # as my permalink character however I'm sure a smarter solution could be found

A simple way to do it would be to replace $el.text by $el.contents().first().text(), however this would probably break when using the markdown-it-anchor setting to put the permalink before the text

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.