=== BlockCode Exporter ===
Contributors: georgelz
Tags: gutenberg, export, block editor, source
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.2
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Download the original WordPress block code in a .md file, directly from admin post lists.

== Description ==

BlockCode Exporter adds an Export Block Code link to your Posts, Pages, and supported custom post type lists.

Click the link to download the saved content as a `.md` file. The file keeps the original block code, including comments such as `<!-- wp:group {...} -->`, block settings, HTML, and styles. It does not convert the content to Markdown.

You can use it to keep a copy of a page's block code or move that code into another WordPress editor. Save your changes before exporting.

There are no settings to configure. The plugin does not change your posts, store export files on your server, or send data to an external service.

Developed by George Zamfir.

== Installation ==

1. Go to Plugins > Add New > Upload Plugin and select `blockcode-exporter.zip`.
2. Install and activate BlockCode Exporter.
3. Open Posts, Pages, or a supported custom post type list.
4. Find the post you want and click Export Block Code.

Requires WordPress 6.6 or later and PHP 8.2 or later.

= Updating an existing installation =

If you already use BlockCode Exporter 0.3.0 or later, upload the new ZIP and choose Replace current with uploaded.

If you still use version 0.1.0 or 0.2.0, deactivate and delete that plugin first, then install BlockCode Exporter. The plugin folder changed in version 0.3.0. Removing the old plugin does not delete your posts. Keep only the new plugin active.

If your installed private build has a higher version number, upload this ZIP and choose Replace current with uploaded to install the public release.

== Frequently Asked Questions ==

= Why does the file use .md if it contains block code? =

The `.md` extension is kept for compatibility with the original export workflow. The file contains the saved WordPress source, including its block comments and HTML. Open it in a text or code editor. A Markdown preview may hide parts of that source.

= How do I use the exported code in WordPress? =

Open the file in a text editor and copy its contents. In the destination WordPress post or page, switch to the Code editor and paste the code where you want the blocks to appear. Switch back to the Visual editor to check the result before saving.

= Will the page look the same on another site? =

That depends on the destination site's theme, styles, and available blocks. The export does not include media files, plugins, or theme settings. Image URLs may still point to the original site.

= Are synced blocks included? =

A synced block stays as a reference, such as `<!-- wp:block {"ref":123} /-->`. The export does not include the referenced block's content. That reference may not work on another site.

= What content can I export? =

You can export saved posts, pages, and supported custom post types when your account can edit the individual post. This includes drafts and private posts. Unsaved changes, custom fields, and featured-image metadata are not included.

= Why is the export link missing? =

Check that the plugin is active and your account can edit the post. The link appears in post lists, alongside actions such as Edit. Attachments, revisions, and navigation items are excluded. Internal WordPress post types are disabled by default.

= Does the plugin track activity or change my content? =

No. It reads the saved content and downloads it to your computer. It does not track usage, keep an export history, or change the post. Shortcodes and dynamic blocks are exported as saved code; they are not executed during export.

== Screenshots ==

1. Export Block Code appears alongside the usual actions in the Pages list.
2. The exported file keeps the original block comments, HTML, and styles.

== Developer notes ==

The export returns the saved `post_content` unchanged unless a site applies the `blockcode_exporter_content` filter. The `blockcode_exporter_filename` and `blockcode_exporter_is_post_type_enabled` filters allow filename and post type changes. Permission checks still apply, and filenames are sanitized after filtering.

Version 0.3.0 introduced the `BlockCodeExporter` namespace and `blockcode_exporter` hook prefix. Update any integrations that use the previous names.

The installation ZIP includes the full PHP source and a `README.md` with the packaging script and build instructions. The code is licensed under GPLv2 or later.

== Changelog ==

= 1.0.0 =
* First public release.
* Download saved block code from posts, pages, and supported custom post types.
* Keep block comments, settings, HTML, styles, and whitespace unchanged.
* Export only content the signed-in user can edit.
