=== Draftdrop – Markdown Importer with Front Matter & SEO Fields ===
Contributors: corvet
Tags: markdown, import, importer, front-matter, seo
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.1.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Import Markdown files as WordPress drafts. Reads front matter: title, categories, tags, SEO fields and featured image. Gutenberg and Classic editor.

== Description ==

Draftdrop lets you publish written articles without copying and pasting. Upload one or more `.md` files, check the preview, and create drafts in one step.

**What it does**

* Reads front matter: title, slug, category, tags, excerpt, SEO title, meta description, focus keyphrase, featured image and image alt text.
* Converts the article to native Gutenberg blocks (paragraphs, headings, lists, quotes, code, tables, images, separators). Anything unusual stays as a Custom HTML block, so nothing is lost. If your site uses the Classic editor, clean HTML is saved instead.
* Saves the SEO fields in the format used by Yoast SEO.
* Shows a preview with checks (missing description, title or description too long, duplicates) before anything is created.
* Skips files that were already imported or whose slug already exists.
* Saves everything as a draft (or "pending review"). Nothing is published automatically.

**Safe by design**

* Capability checks (`edit_posts`, `upload_files`) and nonces on every action.
* Article HTML is sanitized with the same rules WordPress uses for post content. Scripts and iframes are removed.
* Uploaded files are read from the temporary upload location and are not stored on your server.

= File format =

`
---
title: Car Rental in Tenerife: Complete Guide
slug: car-rental-tenerife-guide
category: Guides
tags: [tenerife, car rental]
seo_title: Car Rental in Tenerife (2026 Guide)
meta_description: Everything you need to know before renting a car in Tenerife.
focus_keyword: car rental tenerife
featured_image: https://example.com/images/tenerife.jpg
image_alt: Rental car on a coastal road
---

The article body in Markdown.
`

Only `title` is required.

== External services ==

Draftdrop makes no external requests on its own. The only exception: if a file contains a `featured_image` URL, the plugin downloads that image once, when you confirm the import, using the WordPress HTTP API (`wp_safe_remote_get`). No data about you or your site is sent.

== Third-party libraries ==

* Parsedown 1.8.0-beta-7 by Emanuil Rusev, MIT license. Included in `lib/` (the class is renamed `Draftdrop_Parsedown` to avoid clashes with other plugins; otherwise unmodified). Source: https://github.com/erusev/parsedown

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install it from the Plugins screen.
2. Activate it.
3. Go to Tools > Draftdrop.

== Frequently Asked Questions ==

= Does it need Yoast SEO? =

No. The SEO fields are saved in the format used by Yoast SEO, so they appear automatically if it is active. Without it they are stored and ignored.

= Can it publish immediately? =

Not in this version. Posts are created as drafts (or pending review) so you can check them first.

= What happens to images inside the article? =

They keep their original URLs. Only the featured image is downloaded into the Media Library.

= What happens when I delete the plugin? =

Temporary preview data is removed. Imported posts and images are kept.

== Screenshots ==

1. Upload screen: choose Markdown files and see the supported front matter format.
2. Preview with checks: warnings, errors and duplicates are shown before anything is created.
3. Import finished: links to the new drafts and notes about categories that were created.
4. The imported article in the block editor: headings, nested lists and tables as native blocks, with excerpt and featured image.

== Changelog ==

= 0.1.6 =
* Clearer plugin name and description for the plugin directory; icon, banner and screenshots added. No code changes.

= 0.1.5 =
* Compatibility: tested up to WordPress 7.1.

= 0.1.4 =
* Fixes from the official Plugin Check: standard direct-access guards, stricter handling of uploaded file data, bundled Markdown library renamed to avoid conflicts with other plugins.

= 0.1.3 =
* Tables are saved in the exact format Gutenberg uses, so the editor does not need to convert them.
* The "Create drafts" button is hidden when nothing in the batch can be imported.

= 0.1.2 =
* The preview now reports unsafe HTML that was removed (scripts, styles, iframes and similar). Script and style contents are removed completely.

= 0.1.1 =
* Sites that use the Classic editor now receive plain HTML instead of block markup. Filter: `draftdrop_use_blocks`.

= 0.1.0 =
* First release.
