fencedCodeLanguages
Reports fenced code blocks without a language specified.
✅ This rule is included in the md stylistic
preset.
Fenced code blocks in Markdown allow you to embed syntax-highlighted blocks of other languages. The language name is expected, but not required, after the initial three backticks.
It’s a good idea to provide a language because that allows editors and converters to properly syntax highlight the embedded code.
Even if you’re just embedding plain text, it’s preferable to use text
as the language to explicitly indicate your intention.
Examples
Section titled “Examples”```const message = "Hello, world!";console.log(message);```
```plain text here```
```jsconst message = "Hello, world!";console.log(message);```
```javascriptconst message = "Hello, world!";console.log(message);```
```textplain text here```
```pythondef greet(): print("Hello, world!")```
When Not To Use It
Section titled “When Not To Use It”If you don’t mind languages being inferred rather than explicit, you can safely disable this rule.
Further Reading
Section titled “Further Reading”- MD040 - Fenced code blocks should have a language specified
- GitHub Flavored Markdown - Fenced code blocks
Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
markdown/fenced-code-language
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.