Skip to content

Commit 406e71f

Browse files
committed
apply suggestions
1 parent 56555f9 commit 406e71f

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

docs/rules/fenced-code-meta.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Require or disallow metadata for fenced code blocks.
44

55
## Background
66

7-
Fenced code blocks can include an info string after the opening fence. The first word typically specifies the language (e.g., `js`). Many tools also support additional metadata after the language (separated by whitespace), such as titles or line highlighting parameters. This rule enforces a consistent policy for including such metadata.
7+
Fenced code blocks can include an [info string](https://spec.commonmark.org/0.31.2/#info-string) after the opening fence. The first word typically specifies the language (e.g., `js`). Many tools also support additional metadata after the language (separated by whitespace), such as titles or line highlighting parameters. This rule enforces a consistent policy for including such metadata.
88

99
## Rule Details
1010

src/rules/fenced-code-meta.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default {
6666
column:
6767
node.position.start.column +
6868
langIndex +
69-
node.lang.trim().length,
69+
node.lang.length,
7070
},
7171
},
7272
messageId: "missingMetadata",
@@ -90,7 +90,7 @@ export default {
9090
column:
9191
node.position.start.column +
9292
metaIndex +
93-
node.meta.trim().length,
93+
node.meta.trimEnd().length,
9494
},
9595
},
9696
messageId: "disallowedMetadata",

tests/rules/fenced-code-meta.test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,7 @@ ruleTester.run("fenced-code-meta", rule, {
318318
],
319319
},
320320
{
321-
code: dedent`\`\`\` js foo
322-
console.log("Hello, world!");
323-
\`\`\``,
321+
code: '``` js foo \nconsole.log("Hello, world!");\n```',
324322
options: ["never"],
325323
errors: [
326324
{
@@ -333,9 +331,7 @@ ruleTester.run("fenced-code-meta", rule, {
333331
],
334332
},
335333
{
336-
code: dedent`~~~ js foo
337-
console.log("Hello, world!");
338-
~~~`,
334+
code: '~~~ js foo \nconsole.log("Hello, world!");\n~~~',
339335
options: ["never"],
340336
errors: [
341337
{

0 commit comments

Comments
 (0)