Giter VIP home page Giter VIP logo

md-to-toc's People

Contributors

amaiorano avatar charlestang avatar cmsj avatar haiwenzhu avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

md-to-toc's Issues

TOC Hyperlinks break when titles have `code tags` in them

If any headers have code tags in them, the automatically generated hyperlinks don't work. To fix this, simply remove any backticks (`) from the links.

An example with broken links due to backticks in links:
https://github.com/rbotts/Occupancy/blob/446c2205c8c78eddc87ebd20a86e1bad850dfdea/UnmarkedGuide.md
(note that the two TOC items without any code tags have working links, but all the TOC items with code tags, such as "Creating colext models" do not have working links.)

An example with those links fixed by removing the backticks:
https://github.com/rbotts/Occupancy/blob/f134cb8cb9626463e71df73c01681112eb004e9b/UnmarkedGuide.md
(note that now even the TOC items with code tags do have working links.

The diff between the two:
rbotts/Occupancy@f134cb8#diff-776f5c8d16bf7b01e8f44ec08d2ac678

Fails with full stop and multiple spaces using pandoc

When using pandoc to generate html output, md-to-toc fails to match the generated id if the heading contains a full stop or more than one consecutive space:

Source markdown:

# Multiple   spaces.

Pandoc output:

<h1 id="multiple-spaces.">Multiple spaces.</h1>

md-to-toc output:

- [Multiple   spaces.](#multiple---spaces)

Pandoc keeps the full stop while md-to-toc strips it out.

Pandoc collapses multiple spaces into a single dash while md-to-toc converts every space to a dash.

md-to-toc is designed to replicate GitHub's algorithm for determining anchor strings and GitHub may well handle these cases differently to pandoc. Thought I'd bring it to your attention anyway.

Aside from these two issues, which were trivial to work around, the script worked very well and saved me a lot of time. Thanks!

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.