Markdown Field
A full Markdown editor built on EasyMDE. Editors write in Markdown and optionally preview the rendered HTML inline. The field stores raw Markdown and can return it as-is or converted to HTML.
Settings
| Setting | Default | Options | Description |
|---|---|---|---|
| Height | 300 | Integer ≥ 100 | Editor height in pixels. Step size 50. |
| Return Format | markdown | markdown · html | markdown returns raw text. html converts to HTML via wpautop/wptexturize — requires Pro. |
Return values
return_format: 'markdown'
Returns the raw Markdown string exactly as entered.
$markdown = get_field('post_body');
// "## Hello\n\nThis is **bold** text."
echo esc_html($markdown);
return_format: 'html' (Pro)
Returns HTML processed through wpautop and wptexturize.
$html = get_field('post_body');
// "<h2>Hello</h2>\n<p>This is <strong>bold</strong> text.</p>"
echo wp_kses_post($html);
Usage
Rendering Markdown in a template (free)
Use a Markdown-to-HTML library to convert at render time, or store the raw Markdown for use in headless/API contexts.
$markdown = get_field('article_content');
if ($markdown) {
// Convert with Parsedown (composer require erusev/parsedown)
$Parsedown = new Parsedown();
echo wp_kses_post($Parsedown->text($markdown));
}
Rendering with Pro return format
$html = get_field('article_content');
if ($html) {
echo wp_kses_post($html);
}
REST API / headless output
When serving content via the WP REST API the raw Markdown is ideal — the frontend framework handles rendering.
add_filter('acf/rest/format_value_for_rest', function ($value, $post_id, $field) {
if ($field['type'] === 'efacf_markdown') {
return $value; // already raw Markdown
}
return $value;
}, 10, 3);
The html return format is a Pro-only feature. On the free version, return_format is always treated as markdown regardless of the saved setting.