Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for .mdx files #211

Open
malouro opened this issue Aug 11, 2021 · 4 comments · May be fixed by #256
Open

Support for .mdx files #211

malouro opened this issue Aug 11, 2021 · 4 comments · May be fixed by #256

Comments

@malouro
Copy link

malouro commented Aug 11, 2021

Hey all, we'd like to use this tool to generate TOCs in a bunch of .mdx files, though it seems like out-of-the-box it only supports .md and .markdown. How does adding .mdx to the list of valid markdown extensions sound? Or, alternatively, a way to pass in user-defined file extension(s) via some CLI flag? (--ext=mdx ?)

In the meantime, as a workaround, we've been using something like find . -name "*.mdx" | xargs doctoc ..., though it'd be nice to have it handled & supported via doctoc itself.

Thanks!

@AndrewSouthpaw
Copy link
Collaborator

Hey @malouro, definitely no objections! .mdx seems enough like in the markdown family to include it.

Since we advertise as editing markdown files, let's start with passing an option like --ext=md, that seems like a good first step.

@chris-dura
Copy link

FWIW, I'm actually running this tool on .mdx files (for Storybook stories) and it seems to work...

doctoc src/stories/**/*.mdx src/components/**/*.mdx --gitlab --maxlevel 3 --notitle

The "problem" I have is that the <!-- START | END --> comments break my highlighting in VS Code because .mdx files don't support HTML style comments.

So, I wonder if there can be a configuration option to change the commentStyle from HTML to JSX like {*\ START | END /*}?

@I-3B
Copy link

I-3B commented Jan 27, 2024

@AndrewSouthpaw is this still open for contribution?

@AndrewSouthpaw
Copy link
Collaborator

Yep I can review contributions, just tag me as a reviewer and @ me.

@I-3B I-3B linked a pull request Jan 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants