-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Does not check nested code blocks (only lints top-level code blocks) #470
Comments
code blocks linting is powered by cc @btmills |
From a Markdown syntax perspective, the first set of triple backticks are the text content of an HTML node. Syntax tree from astexplorer ( {
"type": "root",
"children": [
{
"type": "html",
"value": "<main>\n ```js\n im_not_camel_case_oops\n ```\n</main>"
},
{
"type": "code",
"lang": "js",
"meta": null,
"value": "im_not_camel_case_oops"
}
]
} The Markdown plugin only looks for |
@btmills Thanks for your reply! If you don't think it should belong to But I still think there is a chance to add this feature in <main>
```js
im_not_camel_case_oops
```
</main> Because it is just a valid markdown? Take |
Neither GitHub (nor VSCode, which I have handy) render the Code blocks inside details demoi.am(javascript); |
Oh, hey! Check this out: if you include a blank newline between the <main>
```js
im_not_camel_case_oops
```
</main> im_not_camel_case_oops |
OK, so the problem here is code blocks inside html/jsx works a bit different with plain markdown, right? I'll add this feature in mdx later. So you can add a new line for workaround for now. @calebeby |
Initial checklist
Affected packages and versions
I am using eslint-plugin-mdx 2.2.0, eslint-mdx 2.2.0
Link to runnable example
https://stackblitz.com/edit/github-nxeabp?file=testcase.mdx
Steps to reproduce
Here is my mdx file that I am linting:
ESLint only runs on the top-level code block. The code block inside the
<main>
element is ignored.Expected behavior
It should lint both code blocks. I have
mdx/code-blocks
set to true.Actual behavior
It only lints the top-level code block
Runtime
Node v18
Package manager
npm v9
OS
macOS
Build and bundle tools
Other (please specify in steps to reproduce)
The text was updated successfully, but these errors were encountered: