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

HTML comments return unexpected-character on md files #2576

Closed
4 tasks done
tiagoporto opened this issue Jan 8, 2025 · 5 comments
Closed
4 tasks done

HTML comments return unexpected-character on md files #2576

tiagoporto opened this issue Jan 8, 2025 · 5 comments
Labels
🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on

Comments

@tiagoporto
Copy link

Initial checklist

Affected package

remark-mdx

Steps to reproduce

I'm using remark to check md and mdx files.

// .remarkrc
{
"plugins": ["remark-mdx"]
}

Running:

remark . --ext md,mdx

If some markdown file has HTML comments, example:

# README

<!--
 Some comment
-->

I get the following error:
Screenshot 2025-01-08 at 4 05 25 PM

Actual behavior

I get the following error:
Screenshot 2025-01-08 at 4 05 25 PM

Expected behavior

No errors, HTML comments is valid on md files.

Runtime

[email protected]

Package manager

[email protected]

Operating system

Sequoia 15.2

Build and bundle tools

No response

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jan 8, 2025
@remcohaszing
Copy link
Member

No errors, HTML comments is valid on md files.

Yes, but not in MDX. By using remark-mdx, you’re treating md files as MDX. You need to lint markdown and MDX files separately.

Related: unifiedjs/unified-engine#56

@tiagoporto
Copy link
Author

tiagoporto commented Jan 8, 2025

Hi @remcohaszing, after reading the discussion my workaround was adding a new RF file.

.
├── packages
│   ├── .remarkrc (MDX Config)
│   ├── TODO.mdx
│   └── README.mdx
│
├── .remarkrc
└── README.md

Thank you

@wooorm
Copy link
Member

wooorm commented Jan 9, 2025

Config files currently (and perhaps not badly) work the other way around: files are found first, from them config files are found.
Your root command, as in where you call remark, chooses which files to find. That is also where you can configure from.
Meaning, there is a place where you do remark glob/to/**/*.mdx (or: remark --ext mdx .) where you can do --use mdx as well.
And another remark glob/to/**/*.md (or: remark .) where you do not add --use mdx.
If you instead choose to do one command where you find both markdown and mdx at once, then the remaining solution is indeed different config files like what you show!

@wooorm wooorm closed this as completed Jan 9, 2025

This comment has been minimized.

@wooorm wooorm added the 🙅 no/wontfix This is not (enough of) an issue for this project label Jan 9, 2025
Copy link

github-actions bot commented Jan 9, 2025

Hi team! Could you describe why this has been marked as wontfix?

Thanks,
— bb

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

3 participants