Rule

elements

Description

Control which elements can be used on a page, for example to prevent certain heading levels.

This rule can also be used to control macro usage, like the macros rule, but offers greater flexibility to control other non-macro elements.

Ignore pages with label

scq-ignore-elements

Configuration options:

allowed

List of element names that are allowed to be used exclusively.

Every element not in this list will be reported in the quality report.

The value of this property can either be a plain string that specifies the element name or can be an element + parameters that should be allowed (see examples below).

blocked

List of element names that are not allowed to be used.

Every element in this list will be reported in the quality report. If an element is listed on both the allowed and blocked list it will be blocked.

The value of this property can either be a plain string that specifies the element name or can be an element + parameters that should be blocked (see examples below).

Block tables from being used on the page

rules:
  - rule: elements
    level: major
    blocked: tables
YAML

Allow only paragraphs and headings to be used on the page

# this will report usage of any other supported editor element
# such as lists, quotes, tables, emojis, layouts ...

rules:
  - rule: elements
    level: major
    allowed: # multiple elements blocked by name
      - paragraph
      - heading1
      - heading2
      - heading3
      - heading 4
      - heading5
      - heading6
YAML

Block only 3-column layouts from being used on the page

rules:
  - rule: elements
    level: major
    blocked: 
      - element: layout
        parameters:
          type:
            - three_equal
            - three_with_sidebars
YAML

Allow all elements, but for layouts only allow 3-column layouts to be used on the page

rules:
  - rule: elements
    level: major
    allow: 
      - '*'
      - element: layout
        parameters:
          type:
            - three_equal
            - three_with_sidebars
YAML

Check macro usage

# "Code snippet" macros will be reported as major issues

rules:
  - rule: elements
    level: major
    blocked: [code]
YAML

The elements rule can also check macros by name and parameter, just like the macros rule. The difference is that the elements rule can also check other things that are not macros, such as headings.