mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-01 18:03:58 -05:00
18 lines
517 B
JavaScript
18 lines
517 B
JavaScript
module.exports = {
|
|
names: ['closed-code-blocks'],
|
|
description: 'Code blocks must have closing triple backticks',
|
|
tags: ['code'],
|
|
function: function rule(params, onError) {
|
|
params.parsers.micromark.tokens
|
|
.filter(token => token.type === 'codeFenced')
|
|
.forEach(token => {
|
|
if (token.text.trim().slice(-3) !== '```') {
|
|
onError({
|
|
lineNumber: token.endLine,
|
|
detail: `Code blocks must have closing triple backticks.`
|
|
});
|
|
}
|
|
});
|
|
}
|
|
};
|