=== Rectus HTML Source Editor ===
Contributors: rectuswp
Tags: classic-editor, html, codemirror, formatting
Requires at least: 6.8
Tested up to: 7.1
Requires PHP: 7.2.24
Stable tag: 1.1.7
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds HTML syntax highlighting, tag checks, folding, and indentation tools to the classic editor's code editor.

== Description ==

While active, Rectus HTML Source Editor switches posts, pages, and editable custom post types to the classic editor in wp-admin. The main content field opens in code mode with Quicktags. The Visual editor is disabled for that field. Other editor fields, synced patterns, navigation editing, widget editing, the Site Editor, and REST requests keep their usual behavior.

The plugin works with classic editing setups such as Classic Editor or Disable Gutenberg, but does not require either plugin. It uses the CodeMirror files bundled with WordPress and loads its highlighting enhancement only on post editing screens that support an editor. If the user's profile disables syntax highlighting, the content field remains in code mode as a plain textarea with Quicktags.

Features include:

* HTML syntax highlighting with selectable two-space, four-space, or tab indentation, optional automatic indentation on Enter, and font sizes from 12 to 24 pixels. These choices, along with folding and closing-tag completion, are saved for the current WordPress user on this site.
* A tag check for missing or unexpected closing tags. Results are shown as an accessible editor notice and do not block saving.
* A button to format leading indentation on existing lines. Formatting is skipped when the tag check finds an issue. Text inside comments, shortcodes, and sensitive elements such as `pre`, `textarea`, `script`, `style`, and `title` is preserved.
* Compact Format, Check, and Settings buttons appear beside the native Quicktags buttons. Indentation, font size, folding, and closing-tag completion settings are in an accessible dialog. Click an opening tag's line number to fold it; a plus sign appears beside that line number to unfold it. Use Ctrl+Q to toggle folding at the cursor. Press Escape, then Tab to move keyboard focus out of the editor.

The tag check is intended for HTML fragments and understands common optional HTML5 end tags. It is not a complete HTML validator. Formatting changes only leading whitespace; it does not reformat tags, attributes, or text content. The selected indentation style is used by the format action. Folding changes only the display. The format action changes the document, so review it before saving.

Preferences are stored per user and per site in WordPress user options. HTML checks and formatting run in the browser. The plugin uses WordPress's existing post editor, permissions, and save process. If another plugin already replaces the same editor textarea with CodeMirror or provides equivalent HTML editor controls, disable that overlapping feature for the classic editor to avoid competing editor instances.

For a Japanese overview and installation guide, see the [Rectus HTML Source Editor guide (Japanese)](https://www.rectus.co.jp/tool/rectushtmlsourceeditor.html).

= Translations =

English source strings are included. After publication on WordPress.org, translations are managed through translate.wordpress.org and delivered as WordPress language packs when available.

== Installation ==

1. Upload the `rectus-html-source-editor` folder to `/wp-content/plugins/`.
2. Activate the plugin through the Plugins screen.
3. Open a post editing screen. The main content field opens directly in code mode.

== Changelog ==

= 1.1.7 =
* Fix double-escaped content for users who have the visual editor disabled.
* Keep a typed slash after "<" when no closing tag can be completed.
* Update the word count while typing in the code editor.
* Leave reusable block patterns in the block editor.
* Indent the opening line of preformatted and script elements when formatting.
* Use WordPress.org language packs for translations.

= 1.1.6 =
* Add a per-user setting to turn automatic indentation on Enter on or off.

= 1.1.5 =
* Position the settings dialog beside its toolbar button.

= 1.1.4 =
* Make the settings dialog narrower and close it by clicking outside.

= 1.1.3 =
* Show an accessible plus control beside folded HTML elements to unfold them.

= 1.1.2 =
* Place compact plugin buttons beside Quicktags and preserve the fullscreen control.

= 1.1.1 =
* Keep the standard Quicktags toolbar visible and move editor preferences into a dialog.
* Add Japanese translations and complete typed `</` using the current HTML context.

= 1.1.0 =
* Add HTML element folding, selectable indentation styles, and closing-tag completion.

= 1.0.0 =
* Initial release.
