☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

attribute_elements

Table of contents

Description:

This key defines positioning behavior of Markdown attributes for different element types when converting HTML to Markdown.

The value is an object that can contain inline, block, or element-specific properties. Each property value specifies where attribute lists should be positioned for that element type. Valid values are none, right, space right, below, newline below, or right-of-prefix.

This key only takes effect when attributes is enabled.

Appears in:
└── markdown
    └── options
        └── attribute_elements
Type:
Object<attribute_elements.*>
Properties:
blockstring#

This key defines where attribute lists are positioned for block-level elements when converting HTML to Markdown.

The value can be none, right, space right, below, newline below, or right-of-prefix. This applies to all block-level elements unless overridden by element-specific configuration.

This key only takes effect when attributes is enabled.

Allowed values: none right space right below newline below right-of-prefix

Show examplesHide examples

In this example, we have configured block-level elements to place attributes below the element.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    attributes: true
    attribute_elements:
      block: below
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "attributes": true,
      "attribute_elements": {
        "block": "below"
      }
    }
  }
}
inlinestring#

This key defines where attribute lists are positioned for inline elements when converting HTML to Markdown.

The value can be none, right, space right, below, newline below, or right-of-prefix. This applies to all inline elements unless overridden by element-specific configuration.

This key only takes effect when attributes is enabled.

Allowed values: none right space right below newline below right-of-prefix

Show examplesHide examples

In this example, we have configured inline elements to place attributes on the right.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    attributes: true
    attribute_elements:
      inline: right
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "attributes": true,
      "attribute_elements": {
        "inline": "right"
      }
    }
  }
}
Values:
*string#

This key represents an individual element-specific attribute positioning configuration in the markdown.options.attribute_elements object.

The value can be none, right, space right, below, newline below, or right-of-prefix. This determines where attribute lists are positioned for the specified element type when converting HTML to Markdown.

This key only takes effect when attributes is enabled.

Allowed values: none right space right below newline below right-of-prefix

Show examplesHide examples

In this example, we have configured attribute positioning for paragraph elements to place attributes on the right.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    attributes: true
    attribute_elements:
      p: right
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "attributes": true,
      "attribute_elements": {
        "p": "right"
      }
    }
  }
}
Examples:

In this example, we have configured attribute positioning for inline and block elements.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    attributes: true
    attribute_elements:
      inline: right
      block: below
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "attributes": true,
      "attribute_elements": {
        "inline": "right",
        "block": "below"
      }
    }
  }
}
Open in a new tab