summaryrefslogtreecommitdiff
path: root/doc/.markdownlint/rules/tabs_title_text.js
blob: beb329231b1f5ff481546152cc596c7499971339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const { forEachLine, getLineMetadata, isBlankLine } = require(`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',
        });
      }
    });
  },
};