A few months ago I thought to myself: "Why not build a Table of Content generator in Rust?" and I did it and I've been using it ever since almost daily.

Just now I found out that it completely breaks when the markdown file contains a Rust derive in a code block.

Building this tiny tool taught me a lot about parsing text and I'm really glad I did it the hard way without using any markdown crates.


This bug is now fixed in version 2.2.0. crates.io/crates/mktoc

Update cli with

cargo install mktoc --force

With a "Run on save" third-party extension you can run mktoc on every save which is _awesome_.

See instructions at


@kevin there's the homepage link missing from the Cargo.toml, which stops me finding the source and submitting a patch... could you please point me to the source code?

@musicmatze Thanks! Could you also open them as a PR on GitHub? github.com/kevingimbel/mktoc

If not I'll see if I can integrate them later, I've not worked with patches often :D

@kevin Good opportunity to learn it! 😄

opened PRs anyways.

@musicmatze thanks!

I've merged both PRs and published a new version. :)

Sign in to participate in the conversation

bullgit.party is a instance for everyone who is part of bullgit. 🎉