To store and edit Markdown content in CloudCannon, we need to process it into HTML to make it editable. You can use any Markdown engine you want when building your site, this only covers the Markdown content you edit inside CloudCannon.
CloudCannon supports the CommonMark and Kramdown specifications. The implementations for these are markdown-it
(JavaScript) and kramdown
(Ruby).
Jekyll content
CloudCannon automatically reads your settings from _config.yml
to match editing and builds.
To use Kramdown:
markdown
field to kramdown
in _config.yml
kramdown
field in _config.yml
kramdown:
input: GFM
auto_ids: true
To use CommonMark:
jekyll-commonmark
gem to your Gemfile
markdown
field to CommonMark
in _config.yml
commonmark
field in _config.yml
source 'https://rubygems.org'
gem 'jekyll', '3.8.5'
group :jekyll_plugins do
gem 'jekyll-commonmark', '1.3.1'
end
markdown: CommonMark
commonmark:
options: ["SMART", "UNSAFE"]
extensions: ["strikethrough", "table"]
The UNSAFE
option is required for HTML content inside your Markdown files to render correctly.
Hugo content
CloudCannon automatically reads your Goldmark settings from Hugo to match editing and builds. The settings you set for Goldmark are automatically mapped across to markdown-it
.
See the Hugo Documentation for information on how to configure Goldmark. Other engines set with defaultMarkdownHandler
are not officially supported.
The UNSAFE
option is required for HTML content inside your Markdown files to render correctly.
Eleventy content
CloudCannon uses the Eleventy default settings for markdown-it
to match editing and builds.
The default configuration is { html: true }
to match the Eleventy default, but you can update this to match your site by setting the generator.metadata
in your global configuration file:
module.exports = {
generator: {
metadata: {
markdown: 'markdown-it',
'markdown-it': {
html: true,
linkify: true
}
}
}
};
Other content
markdown-it
is the default Markdown processor in CloudCannon.
The default configuration is { html: true }
to allow the images with width and height attributes the Rich Text editors create, but you can update this to match your site by setting the generator.metadata
in your global configuration file:
module.exports = {
generator: {
metadata: {
markdown: 'markdown-it',
'markdown-it': {
html: true,
linkify: true
}
}
}
};
CommonMark does not support a syntax to define attributes on elements. In order to preserve attributes, that content saves as HTML within your Markdown files.