Open I-3B opened 8 months ago
@AndrewSouthpaw would you please review this?
This line may causes problem if some users where only using doctoc for
.md
files, I didn't check for it, should I?
So, if I understand, this means that users would all of a sudden start getting TOCs in their .mdx
files, which they weren't before... I could see how this would be considered a "breaking change" at worst, and annoying at best to users 😅.
I don't think it's worth forcing a MAJOR
version bump, so to keep it backwards compatible, you may want to make the MDX support "opt-in", so the doctoc
command does the same thing by default, and you have to explicitly enable mdx
support?
This line may causes problem if some users where only using doctoc for
.md
files, I didn't check for it, should I?So, if I understand, this means that users would all of a sudden start getting TOCs in their
.mdx
files, which they weren't before... I could see how this would be considered a "breaking change" at worst, and annoying at best to users 😅.I don't think it's worth forcing a
MAJOR
version bump, so to keep it backwards compatible, you may want to make the MDX support "opt-in", so thedoctoc
command does the same thing by default, and you have to explicitly enablemdx
support?
I can think of two approaches:
.mdx
is only matched if --syntax mdx
is provided, but would also still match .md
.mdx
if --syntax mdx
and only match .md
and .markdown
if --syntax md
(default)I like what you're doing with a --syntax
argument better... but I'm an idiot and must've forgot to open a PR from my fork where I implemented this for a local project, just for reference:
https://github.com/thlorenz/doctoc/pull/241
Anyway, not something I thought about in mine, but, I would allow --syntax
to support just .md/.markdown
(default), just .mdx
, or "all syntaxes". Then, the default behavior is unchanged, but you can opt-in to doing .mdx
files, or all of them?
That seems reasonable to me. Not breaking the default behavior is important.
@AndrewSouthpaw hi!
fixed the issue mentioned before here a6ee89ccf7c5f3e0f2bcba4df67bd473979a8b7f, so now mdx files won't get matched unless --syntax mdx is explicitly specified.
Hi there! Sorry it took so long to get back to you. The code looks good, all it needs now is some test coverage and we can ship it! 🥳
Hi~ @AndrewSouthpaw added some tests, should cover the new change, would you like me to add more?
Hi @AndrewSouthpaw ! thanks for the thorough review, can you please go through the new commits to check if they cover the review?
Perfect! One quick lint cleanup and this is good to go. Thanks @I-3B.
closes #211
This line may causes problem if some users where only using doctoc for
.md
files, I didn't check for it, should I?