# MD040 - Fenced Code Blocks Should Have a Language Specified
## Description
This rule ensures that fenced code blocks have a language specified. Adding a language to fenced code blocks
enables syntax highlighting, making the code more readable and easier to understand.
## Examples
### Valid
```javascript
function hello() {
console.log("Hello, world!");
}
```
```python
def hello():
print("Hello, world!")
```
### Invalid
```
function hello() {
console.log("Hello, world!");
}
```
```
def hello():
print("Hello, world!")
```
### Fixed
```javascript
function hello() {
console.log("Hello, world!");
}
```
```python
def hello():
print("Hello, world!")
```
## Configuration
This rule has the following configuration options:
- `allowed_languages`: An array of languages that are allowed. Default is an empty array, which allows any language.
- `language_only`: Whether to only check for the presence of a language, not its validity. Default is `false`.
## Special Cases
- This rule only applies to fenced code blocks (using backticks or tildes)
- It does not apply to indented code blocks
- The rule checks for the presence of a language specifier after the opening fence
- Common language specifiers include: `javascript`, `python`, `ruby`, `bash`, `markdown`, etc.
- Some Markdown processors support additional language aliases or custom language specifiers
## Related Rules
- [MD031 - Fenced code blocks should be surrounded by blank lines](md031.md): Ensures proper spacing around code blocks
- [MD046 - Code block style](md046.md): Ensures consistent code block style
- [MD048 - Code fence style](md048.md): Ensures consistent code fence style