badboy / mdbook-toc

A preprocessor for mdbook to add inline Table of Contents support.
Mozilla Public License 2.0
163 stars 20 forks source link

Don't hardcode unix newlines in default marker #35

Closed Gankra closed 1 year ago

Gankra commented 1 year ago

Not 100% sure if this is the ideal solution for you but I just spent like 2 hours being extremely confused and trying to debug mdbook-toc not working at all... because the default template is completely broken in the face of inputs with CRLFs in them (I'm on windows).

I can manually fix this in my own project by setting the marker to this in the config, but it's a nasty landmine for others that should probably get some kind of a fix..?

Gankra commented 1 year ago

oh cool apparently setting marker = "<!-- toc -->" in my book.toml fixes windows but breaks linux

cool cool cool cool cool

badboy commented 1 year ago

Yeah, the problem is that we check the marker against the parsed markdown events AND some people wanted multi-line markers, so we now also parse the marker and then look for equivalent events. And we don't even test on Windows or with CRLF input so of course we never stumbled upon this.

Let me think about how to address that better.