Skip to content
TASKMOD/

Taskmod Plugin Directory

Tiny Basic Editor

Tiny Basic Editor is a lightweight, reusable WordPress plugin that adds a simple Markdown formatting toolbar to standard HTML textareas. It allows other WordPress plugins to provide basic text formatting without integrating a large editor framework. Tiny Basic Editor is not a WYSIWYG editor and does not replace the WordPress Classic Editor or Block Editor

In development Free Version 1.0.2

Tiny Basic Editor

Developer Documentation

Version: 1.0.2
Plugin: Tiny Basic Editor
Author: AfterAGI

1. Introduction

Tiny Basic Editor is a lightweight, reusable WordPress plugin that adds a simple Markdown formatting toolbar to standard HTML textareas.

It allows other WordPress plugins to provide basic text formatting without integrating a large editor framework.

Tiny Basic Editor is not a WYSIWYG editor and does not replace the WordPress Classic Editor or Block Editor.

Key Features

  • Lightweight vanilla JavaScript implementation.
  • No jQuery, React, Vue or CodeMirror dependency.
  • No external CDN or third-party runtime dependency.
  • Configurable formatting toolbar.
  • Markdown-based content storage.
  • Simple Preview and Write toggle.
  • Server-side Markdown rendering.
  • HTML sanitization using WordPress security functions.
  • Reusable PHP functions for other plugins.

2. Installation

  1. Download the Tiny Basic Editor plugin ZIP.
  2. Open WordPress Dashboard.
  3. Navigate to Plugins → Add New Plugin.
  4. Select Upload Plugin.
  5. Upload the ZIP file and activate the plugin.

After activation, open:

Settings → Tiny Basic Editor

3. Plugin Settings

Administrators can select which formatting features should be available to plugins using Tiny Basic Editor.

The available features are:

Bold

Markdown syntax: **important text**

Italic

Markdown syntax: *emphasized text*

Heading

Markdown syntax: ## Heading

Bulleted List

Markdown syntax: - List item

Link

Markdown syntax: [Source](https://example.com)

Blockquote

Markdown syntax: > Quoted text

Code Block

Markdown syntax: Triple backticks surrounding the code.

The Preview/Write toggle is always available.

These settings apply globally. An integrating plugin can restrict the available features for an individual editor field, but cannot override features disabled by the administrator.

4. Using Tiny Basic Editor in Other Plugins

Tiny Basic Editor provides two public PHP functions.

4.1 Create an Editor Field

Function:

tbe_editor( array $args ): string

This function generates the editor HTML.

Example:

echo tbe_editor([
    'id' => 'project-description',
    'name' => 'project_description',
    'label' => 'Project description',
    'value' => $saved_markdown,
    'rows' => 10,
    'placeholder' => 'Describe the project...',
    'required' => true,
    'features' => ['bold', 'italic', 'list', 'link', 'quote'],
]);

Available arguments:

  • id: HTML textarea ID. Automatically generated if omitted.
  • name: Submitted form field name. Default is content.
  • value: Initial Markdown content.
  • rows: Textarea height in rows. Minimum 3 and maximum 40.
  • placeholder: Placeholder text.
  • class: Additional CSS class for the textarea.
  • label: Visible and accessible field label.
  • required: Adds the HTML required attribute.
  • features: Optional list of toolbar features to allow.

4.2 Render Markdown Content

Function:

tbe_render_markdown( string $markdown ): string

This converts supported Markdown into sanitized HTML.

Example:

echo tbe_render_markdown($stored_markdown);

Always use this function when displaying stored Markdown content.

Do not directly output member-submitted Markdown as HTML.

5. Shortcode Usage

Tiny Basic Editor also provides a shortcode for simple WordPress pages.

Example:

[tbe_editor name="description" id="description" rows="8" label="Description" placeholder="Write here..."]

For application forms and custom plugins, the PHP function is recommended because the integrating plugin retains control over content storage, permissions and form processing.

6. Recommended Integration Method

When integrating Tiny Basic Editor into another plugin, follow this approach:

  1. Check whether Tiny Basic Editor is active.
  2. Use tbe_editor() to generate the editor field.
  3. If Tiny Basic Editor is unavailable, display a normal HTML textarea.
  4. Verify the integrating plugin’s security nonce when processing submitted content.
  5. Verify the current user’s permissions.
  6. Validate and store the Markdown content in the integrating plugin’s own database or storage system.
  7. Use tbe_render_markdown() when displaying the saved content.
  8. If Tiny Basic Editor is unavailable, safely escape the content and display it as ordinary text.

Example with fallback:

if (function_exists('tbe_editor')) {
    echo tbe_editor([
        'name' => 'body',
        'label' => 'Details',
        'value' => $saved_body,
        'required' => true,
    ]);
} else {
    printf(
        '<label for="body">Details</label>
        <textarea id="body" name="body" required>%s</textarea>',
        esc_textarea($saved_body)
    );
}

7. Supported Markdown

Tiny Basic Editor implements a deliberately limited Markdown subset.

Block Formatting

  • Paragraphs
  • Headings (levels 1–3)
  • Bulleted lists
  • Blockquotes
  • Fenced code blocks

Inline Formatting

  • Bold
  • Italic
  • Inline code
  • HTTP and HTTPS links

Unsupported Formatting

The current version does not support:

  • Tables
  • Image uploads
  • Nested lists
  • Strikethrough
  • Task lists
  • Arbitrary HTML
  • Complex document layouts

Tiny Basic Editor is not intended to implement the complete CommonMark specification.

8. Security

Tiny Basic Editor separates editing from content storage and permissions.

The integrating plugin remains responsible for:

  • Authentication
  • Authorization
  • Database writes
  • Content ownership
  • Moderation
  • Application-specific validation

The Markdown renderer escapes ordinary text and allows only a limited set of HTML elements and attributes through WordPress wp_kses().

Links are restricted to HTTP and HTTPS URLs and receive nofollow and noopener attributes.

Raw HTML submitted by members is not supported.

Always verify nonces and user permissions in the integrating plugin before saving submitted content.

9. Frontend Assets

Tiny Basic Editor uses:

  • assets/js/editor.js
  • assets/css/editor.css

These assets are loaded only when an editor field or shortcode is rendered.

The editor uses vanilla JavaScript and does not require an external JavaScript framework.

10. Markdown Preview REST Endpoint

Tiny Basic Editor provides a REST endpoint for rendering Markdown previews.

Endpoint:

/wp-json/tiny-basic-editor/v1/preview

The endpoint accepts Markdown text and returns sanitized HTML.

It is intended for preview rendering only. It does not save content or grant editing permissions.

The endpoint is registered using the WordPress rest_api_init action.

11. Compatibility

Current version: 1.0.2

Minimum requirements:

  • WordPress 6.6 or newer.
  • PHP 8.1 or newer.

The plugin is designed to be independent of individual application plugins.

If Tiny Basic Editor is deactivated, integrating plugins should continue functioning through their plain-textarea fallback.

12. Development Philosophy

Tiny Basic Editor follows a simple design philosophy:

  • Keep the editor small.
  • Avoid unnecessary dependencies.
  • Store content in portable Markdown format.
  • Let individual plugins control their own data.
  • Keep content rendering safe.
  • Load frontend assets only when required.

This makes Tiny Basic Editor suitable for community platforms, directories, project management tools, documentation systems and other custom WordPress applications.


Tiny Basic Editor
A lightweight Markdown editor for WordPress plugins.

Developed by AfterAGI.