Skip to content

sherer-pro/simple-export-md

Repository files navigation

Export Gutenberg to Markdown — README

Basis: the final result of our work on the plugin, including all discussed improvements: PHP/WP checks, localization, JS minification, smooth notifications, .po/.json support, and wordpress.org requirements.

Description

The plugin adds an “Export to Markdown” panel to the Gutenberg block editor, allowing you to:

  • download the current post as a .md file;
  • copy the Markdown to the clipboard.

Conversion is performed in the browser via the Turndown library. The plugin makes no external requests, does not save files on the server, and works completely locally.

YAML front matter is generated: title, slug, date, categories, tags.

The plugin is optimized for wordpress.org requirements: uses wp_set_script_translations, has minimal load, supports localization, and correctly checks PHP/WP versions.

Features

  • Export Markdown directly from the Gutenberg editor.
  • Two modes: .md download and Markdown copy.
  • Automatic front matter.
  • Supports all standard Gutenberg blocks.
  • Smooth notification animations.
  • Full localization (EN, RU, UK, DE, ES, IT, FR).
  • Minified JS version (export-md.min.js) with automatic switching based on SCRIPT_DEBUG.
  • PHP/WP version checks and automatic deactivation if requirements are not met.

Requirements

  • WordPress 6.0+
  • PHP 7.4+
  • Active Gutenberg editor

The code technically works from PHP 5.3, but the official minimum is set to 7.4.

Installation

  1. Copy the simple-export-md folder into wp-content/plugins/

  2. Ensure it contains:

    • simple-export-md.php
    • assets/export-md.js
    • assets/export-md.min.js
    • assets/turndown.js
    • languages/ with .po and .json files
  3. Activate the plugin in the “Plugins” menu.

Usage

  1. Open any post/page in Gutenberg.

  2. Enable the right settings panel (⚙ icon).

  3. Find the Export to Markdown section.

  4. Click:

    • Download .md — to download the file,
    • Copy Markdown — to copy it to the clipboard.

After completion, a smooth notification will appear.

Plugin Structure

simple-export-md/
  simple-export-md.php
  assets/
    export-md.js
    export-md.min.js
    turndown.js
  languages/
    simple-export-md-ru_RU.po
    simple-export-md-uk.po
    simple-export-md-de_DE.po
    simple-export-md-es_ES.po
    simple-export-md-it_IT.po
    simple-export-md-fr_FR.po
    *.json (generated by wp i18n make-json)
  readme.txt

Localization

For JS localization WordPress requires .json files. Generate them with:

wp i18n make-json languages --no-purge

or on Windows:

npx @wordpress/i18n-cli make-json languages --no-purge

Ukrainian must use the code uk (not uk_UA).

JS Minification

The minified version is built using terser:

npx terser assets/export-md.js -c -m -o assets/export-md.min.js --source-map

The plugin selects automatically:

  • export-md.min.js — in production,
  • export-md.js — when SCRIPT_DEBUG is enabled.

PHP/WP Version Checks

The plugin checks:

  • PHP >= 7.4
  • WordPress >= 6.0

If requirements are not met:

  • an admin notice is shown,
  • the plugin deactivates itself,
  • further loading stops.

This prevents potential fatal errors.

Limitations

  • Custom blocks are exported as HTML fragments (standard for Markdown converters).
  • Media files are not downloaded or packaged — absolute URLs are used.
  • Clipboard API must be available in the browser.

Roadmap

  • Export ZIP archive with media files.
  • Front matter settings.
  • Support for custom blocks.
  • Hotkeys and quick actions.

License

GPLv2 or later.

© 2025 Pavel Sherer (sherer.pro)

About

Adds a Gutenberg editor panel to export any post or page content to Markdown format (.md file or clipboard).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors