diff options
Diffstat (limited to 'doc/.markdownlint/rules/tabs_title_text.js')
-rw-r--r-- | doc/.markdownlint/rules/tabs_title_text.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/.markdownlint/rules/tabs_title_text.js b/doc/.markdownlint/rules/tabs_title_text.js new file mode 100644 index 00000000000..672aa70f562 --- /dev/null +++ b/doc/.markdownlint/rules/tabs_title_text.js @@ -0,0 +1,23 @@ +const { globalPath } = require('../require_helper'); +const { + forEachLine, + getLineMetadata, + isBlankLine, +} = require(`${globalPath}/markdownlint-rule-helpers`); + +module.exports = { + names: ['tabs-title-text'], + description: 'Tab without title text', + information: new URL('https://docs.gitlab.com/ee/development/documentation/styleguide/#tabs'), + tags: ['gitlab-docs', 'tabs'], + function: (params, onError) => { + forEachLine(getLineMetadata(params), (line, lineIndex) => { + if (!isBlankLine(line) && line.replace(':::TabTitle', '').trim() === '') { + onError({ + lineNumber: lineIndex + 1, + detail: 'Expected: :::TabTitle <your title here>; Actual: :::TabTitle', + }); + } + }); + }, +}; |