=== MarkuClean – AI Markup Cleaner ===
Contributors: ivijanstefan, creativform
Tags: content-cleanup, markup, gutenberg, classic-editor, ai
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 8.0
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

MarkuClean Markup Cleaner cleans and normalizes post content in supported WordPress editing contexts.

== Description ==

MarkuClean Markup Cleaner cleans and normalizes post content in supported WordPress editing contexts.

It removes unwanted characters, markup artifacts, and copy-and-paste leftovers from post title, content, and excerpt values. This includes known special characters and malformed sequences commonly introduced by AI-generated content and external copy tools, such as mis-encoded quotes, dashes, ellipses, non-breaking spaces, zero-width characters, and numeric data-start/data-end markers.

The plugin helps keep content consistent and clean where cleanup is supported. It works with standard WordPress content edited in Gutenberg and TinyMCE-based workflows.

For safety, builder-managed content is skipped. Elementor, WPBakery / Visual Composer, Beaver Builder, Divi Builder, Oxygen, Bricks, SiteOrigin, and similar editors often store structured markup, shortcode trees, JSON-like payloads, or hidden metadata. The plugin returns that content unchanged.

== Installation ==

Install from WordPress admin:

1. Go to Plugins > Add New.
2. Search for "MarkuClean Markup Cleaner".
3. Install and activate the plugin.

Manual installation:

1. Upload the plugin folder to `/wp-content/plugins/`.
2. Activate the plugin in WordPress admin.
3. Open Settings > AI Content Cleaner and configure the enabled post types and cleanup modes.

== Frequently Asked Questions ==

= Why does the plugin not work with Elementor or other builders? =

This is intentional. Builders store structured markup, shortcodes, JSON-like payloads, and metadata that the plugin does not modify.

= What characters does the plugin remove or normalize? =

It can normalize configured character replacements such as mis-encoded quotes, dashes, ellipses, non-breaking spaces, zero-width characters, and similar copy artifacts. It also removes numeric data-start/data-end markers and selected AI paste remnants where supported.

= Does it change existing content permanently? =

Only when save cleanup is enabled and the current content passes the safety checks. Frontend cleanup and tester previews do not change stored content.

= Can I limit it to specific post types? =

Yes. Enabled post types are configured in the plugin settings and are enforced across supported frontend, editor, and save-time flows.

= What is the difference between display cleanup and save cleanup? =

Display cleanup changes frontend output only and does not write to the database. Save cleanup modifies stored content when it is enabled and the current content passes the safety checks.

= Is it safe to use on live websites? =

It is designed to skip unsupported contexts and builder-managed content. Use the tester first and review save cleanup settings before applying cleanup to existing content.

== Changelog ==

= 1.0.2 =
* Fix: prevent fatal errors with legacy WPBakery / Visual Composer on PHP 8.3
* Fix: harden all WordPress hook callbacks against unexpected input types
* Fix: ensure wp_insert_post_data callbacks are safe under legacy conditions
* Improvement: extend legacy WPBakery / Visual Composer detection
* Improvement: increase overall runtime compatibility with older plugins and themes

= 1.0.1 =
* Fix: Save cleanup is now truly opt-in, no stored content is modified when disabled
* Fix: Removed hardcoded "ChatGPT" text removal from sanitizer
* Improvement: DOM cleanup now triggers only on structural AI/UI markers, not keywords
* Fix: Prevent unintended content mutation in supported editors (Gutenberg, Classic)
* Fix: Sidebar preview default value is now consistent across settings, UI, and runtime
* Fix: Regex/replacement fields now preserve valid patterns (<, >, etc.)
* Fix: PHP version requirement comment aligned with actual minimum version
* Improvement: Updated admin UI examples to avoid misleading cleanup rules
* Improvement: Increased overall sanitizer safety and reduced false-positive cleaning

= 1.0.0 =
* Initial release.
