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

options

Table of contents

Description:

This key defines configuration options for the Markdown processing engine.

The value is an object that can contain various options controlling how Markdown is converted to HTML and vice versa.

Appears in:
└── markdown
    └── options
Type:
Object
Properties:

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.

Show examplesHide 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"
      }
    }
  }
}

This key toggles whether CloudCannon will save element attributes in Markdown format instead of converting them to HTML when converting HTML to Markdown.

Setting this key to true will preserve element attributes in Markdown format (using attribute lists) rather than converting them to HTML.

By default, this key is false (i.e., element attributes are converted to HTML).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to save element attributes in Markdown format.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    attributes: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "attributes": true
    }
  }
}
breaksboolean#

This key toggles whether CloudCannon will convert line breaks (\n) in paragraphs into <br> tags when converting Markdown to HTML.

Setting this key to true will convert line breaks within paragraphs into <br> tags.

By default, this key is false (i.e., line breaks in paragraphs are not converted to <br> tags).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to convert line breaks in paragraphs into <br> tags.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    breaks: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "breaks": true
    }
  }
}

This key defines which style of code block fences CloudCannon will use when converting HTML to Markdown.

The value can be \``(three backticks) or~~~` (three tildes).

Allowed values: ``` ~~~

Show examplesHide examples

In this example, we have configured Markdown to use tildes for code block fences.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    code_block_fences: ~~~
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "code_block_fences": "~~~"
    }
  }
}

This key toggles whether CloudCannon will render snippets as plain text within code blocks when processing Markdown.

Setting this key to true will prevent snippets from being processed within code blocks, rendering them as plain text instead.

By default, this key is false (i.e., snippets within code blocks may be processed).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to render snippets as plain text within code blocks.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    escape_snippets_in_code_blocks: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "escape_snippets_in_code_blocks": true
    }
  }
}
gfmboolean#

This key toggles whether CloudCannon will enable GitHub Flavored Markdown (GFM) mode when processing Markdown.

Setting this key to true will enable GFM mode, which includes features like tables, strikethrough, task lists, and autolinks.

By default, this key is false (i.e., GFM mode is disabled).

Show examplesHide examples

In this example, we have configured Markdown to enable GitHub Flavored Markdown mode.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    gfm: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "gfm": true
    }
  }
}

This key toggles whether CloudCannon will generate IDs for headings when converting Markdown to HTML.

Setting this key to true will automatically generate ID attributes for heading elements based on their text content.

By default, this key is false (i.e., IDs are not generated for headings).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to generate IDs for headings.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    heading_ids: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "heading_ids": true
    }
  }
}
htmlboolean#

This key toggles whether CloudCannon will output HTML tags from source when converting Markdown to HTML.

Setting this key to true will allow HTML tags in the Markdown source to be output in the resulting HTML.

By default, this key is false (i.e., HTML tags in Markdown source are not output).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to output HTML tags from source.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    html: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "html": true
    }
  }
}
linkifyboolean#

This key toggles whether CloudCannon will automatically convert URL-like text to links when converting Markdown to HTML.

Setting this key to true will automatically convert text that looks like URLs into clickable links.

By default, this key is false (i.e., URL-like text is not automatically converted to links).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to automatically convert URL-like text to links.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    linkify: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "linkify": true
    }
  }
}
quotesstring#

This key defines double and single quotes replacement pairs for quote beautification when typographer is enabled.

The value is a string that specifies quote pairs. For example, you can use "«»„"" for Russian, ""„"‚"" for German, and ["«\xA0", "\xA0»", "‹\xA0", "\xA0›"] for French (including nbsp).

This key only takes effect when typographer is enabled.

Show examplesHide examples

In this example, we have configured quote replacement pairs for Russian typography.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    typographer: true
    quotes: «»„""
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "typographer": true,
      "quotes": "«»„\"\""
    }
  }
}

This key toggles whether CloudCannon will add line breaks between sentences when converting HTML to Markdown.

Setting this key to true will add line breaks between sentences in the output Markdown.

By default, this key is false (i.e., line breaks are not added between sentences).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to add line breaks between sentences.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    sentence_per_line: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "sentence_per_line": true
    }
  }
}

This key toggles whether CloudCannon will output lists with an extra space when converting HTML to Markdown.

Setting this key to true will add an extra space in list items when outputting Markdown.

By default, this key is false (i.e., lists are output without an extra space).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to output lists with an extra space.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    spaced_lists: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "spaced_lists": true
    }
  }
}

This key toggles whether CloudCannon will output strikethrough text wrapped in double tildes when converting HTML to Markdown.

Setting this key to true will output strikethrough text as ~~strike~~ in Markdown.

By default, this key is false (i.e., strikethrough text is not output in double tildes format).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to output strikethrough text wrapped in double tildes.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    strikethrough: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "strikethrough": true
    }
  }
}
subscriptboolean#

This key toggles whether CloudCannon will output subscript text wrapped in tildes when converting HTML to Markdown.

Setting this key to true will output subscript text as ~sub~ in Markdown.

By default, this key is false (i.e., subscript text is not output in tildes format).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to output subscript text wrapped in tildes.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    subscript: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "subscript": true
    }
  }
}

This key toggles whether CloudCannon will output superscript text wrapped in carets when converting HTML to Markdown.

Setting this key to true will output superscript text as ^super^ in Markdown.

By default, this key is false (i.e., superscript text is not output in carets format).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to output superscript text wrapped in carets.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    superscript: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "superscript": true
    }
  }
}
tableboolean#

This key toggles whether CloudCannon will output tables in Markdown format when converting HTML to Markdown.

Setting this key to true will convert HTML tables to Markdown table format.

By default, this key is false (i.e., tables are not output in Markdown format).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to output tables in Markdown format.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    table: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "table": true
    }
  }
}

This key toggles whether CloudCannon will treat 4 spaces of indentation as a code block when processing Markdown.

Setting this key to true will read indented blocks (4 spaces) as code blocks.

By default, this key is false (i.e., indented blocks are not treated as code blocks).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to treat 4 spaces of indentation as code blocks.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    treat_indentation_as_code: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "treat_indentation_as_code": true
    }
  }
}

This key toggles whether CloudCannon will enable typographic replacements and quote beautification when converting Markdown to HTML.

Setting this key to true will enable language-neutral replacements (such as dashes and ellipses) and beautify quotes based on the quotes configuration.

By default, this key is false (i.e., typographic replacements and quote beautification are disabled).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to enable typographic replacements and quote beautification.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    typographer: true
    quotes: «»„""
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "typographer": true,
      "quotes": "«»„\"\""
    }
  }
}
xhtmlboolean#

This key toggles whether CloudCannon will use XHTML-style closing for single tags when converting Markdown to HTML.

Setting this key to true will use / to close single tags (e.g., <br /> instead of <br>).

By default, this key is false (i.e., single tags are not closed with /).

Defaults to: false

Show examplesHide examples

In this example, we have configured Markdown to use XHTML-style closing for single tags.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    xhtml: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "xhtml": true
    }
  }
}
Examples:

In this example, we have configured Markdown options to enable HTML output, convert line breaks, and enable GitHub Flavored Markdown.

Copied to clipboard
markdown:
  engine: commonmark
  options:
    html: true
    breaks: true
    gfm: true
{
  "markdown": {
    "engine": "commonmark",
    "options": {
      "html": true,
      "breaks": true,
      "gfm": true
    }
  }
}
Open in a new tab