-
-
Notifications
You must be signed in to change notification settings - Fork 479
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
feat: add mdx support #256
base: master
Are you sure you want to change the base?
Conversation
@AndrewSouthpaw would you please review this? |
So, if I understand, this means that users would all of a sudden start getting TOCs in their I don't think it's worth forcing a |
I can think of two approaches:
|
I like what you're doing with a Anyway, not something I thought about in mine, but, I would allow |
That seems reasonable to me. Not breaking the default behavior is important. |
@AndrewSouthpaw hi! fixed the issue mentioned before here a6ee89c, 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Sorry for a few more comments, I did one more thorough review, and just a few tweaks would make this code cleaner. Thanks for the additional tests. 😄
@thlorenz would you want to bump and publish the new version number, or should I take care of that? This seems like a minor version bump.
Hi @AndrewSouthpaw ! |
Perfect! One quick lint cleanup and this is good to go. Thanks @I-3B. |
Co-authored-by: Andrew Smith <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 7 changed files in this pull request and generated no suggestions.
Files not reviewed (2)
- test/fixtures/readme-syntax.mdx: Language not supported
- lib/file.js: Evaluated as low risk
Comments skipped due to low confidence (4)
test/file.js:26
- The test case for undefined syntax should use
undefined
instead of'md'
to accurately test the default behavior.
_(findMarkdownFiles(fixturesDir, 'md')).every((file) => file.path.endsWith('.md'))
lib/transform.js:22
- The
start
andend
properties of theexports
object are set tostartMd
andendMd
, which could cause confusion if the syntax is changed dynamically. Ensure that thestart
andend
properties are updated correctly based on the syntax.
var { start: startMd , end: endMd } = generateComments('md')
lib/transform.js:49
- The
generateComments
function modifies theexports
object directly. Ensure that the function does not modify theexports
object to avoid unexpected behavior.
function generateComments(syntax){
lib/transform.js:24
- The
matchesStart
andmatchesEnd
functions are defined within thetransform
function, which could lead to performance issues if thetransform
function is called frequently. Move these functions outside of thetransform
function to avoid redefining them multiple times.
function matchesStart(syntax) {
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?