Skip to content

Commit fe8c3f7

Browse files
committed
Match MDX code highlight metadata parsing
1 parent f647717 commit fe8c3f7

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
```js [[1, 1, "submitAction"]]
22
function submitAction() {}
33
```
4+
5+
```js [[1, 1, "\\"hidden\\""]]
6+
const mode = "hidden";
7+
```

‎eslint-local-rules/rules/lint-markdown-code-blocks.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = {
4545
// For each supported code block, run the compiler and reconcile metadata.
4646
for (const block of blocks) {
4747
for (const message of validateInlineHighlights(
48-
block.fence.metaText,
48+
block.meta,
4949
block.code
5050
)) {
5151
context.report({

‎eslint-local-rules/rules/markdown.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const {parseFenceMetadata} = require('./metadata');
1616
* @property {{lineIndex: number, rawText: string, metaText: string, range: [number, number]}} fence
1717
* @property {string} filePath
1818
* @property {string} lang
19+
* @property {string} meta
1920
* @property {import('./metadata').FenceMetadata} metadata
2021
*/
2122

@@ -76,6 +77,7 @@ function parseMarkdownFile(content, filePath) {
7677

7778
blocks.push({
7879
lang: rawLang || normalizedLang,
80+
meta: node.meta || metaText.trim(),
7981
metadata,
8082
filePath,
8183
code: node.value || '',

0 commit comments

Comments
 (0)