HTML Tags as Gutenberg Blocks
HTMLBerg is a WordPress plugin that brings the power of HTML tags to the Gutenberg editor. Create and customize any HTML tag as a block, with full support for WordPress styling options like colors, spacing, and borders. Perfect for developers and content creators who want precise control over their markup within the block editor.
- Universal Tag Block: Render any HTML tag (e.g.,
div
,span
,section
) with custom attributes and native Gutenberg styling. - Lightweight & Focused: Designed exclusively for HTML tag blocks, keeping it simple and efficient.
- Seamless Styling: Matches editor and front-end appearances using WordPress’s built-in style supports.
- Download the latest release from the GitHub Releases page or clone the repository:
git clone https://github.com/YasinC2/htmlberg.git
- Move the
htmlberg
folder to your WordPress plugins directory (wp-content/plugins/
). - Activate the plugin via the WordPress admin panel (Plugins > Installed Plugins).
See the Building the Plugin section below to compile the plugin yourself.
- After activation, open the WordPress block editor (Gutenberg).
- Add the HTMLBerg Universal Block from the block inserter.
- Customize the block in the inspector panel:
- HTML Tag: Select the tag to render (e.g.,
div
,span
). - Attributes: Add predefined (e.g.,
id
,class
) or custom attributes (e.g.,data-id="123"
). - Styling: Use Gutenberg’s built-in options for colors, spacing, and borders.
- HTML Tag: Select the tag to render (e.g.,
- Save your page and check the front-end result.
HTMLBerg uses JavaScript (React) and PHP to deliver its functionality. To build it from source, follow these steps:
- Node.js and npm: Install Node.js (version 16+ recommended) and npm. Download here.
- WordPress Environment: A local or remote WordPress installation for testing.
-
Clone the Repository:
git clone https://github.com/YasinC2/htmlberg.git cd htmlberg
-
Install Dependencies: Run this command to install JavaScript dependencies:
npm install
-
Compile the Blocks: Use
@wordpress/scripts
to build the JavaScript:npm run build
- This compiles
src/edit.js
andsrc/save.js
into abuild/
folder (e.g.,build/index.js
).
- This compiles
-
Test Locally:
- Move the
htmlberg
folder to your WordPresswp-content/plugins/
directory. - Activate the plugin and test in the block editor.
- Move the
Contributions are welcome! To contribute:
- Fork the repository.
- Create a branch for your changes.
- Commit and push your changes, then open a pull request.
Follow WordPress coding standards for PHP and JavaScript.
Licensed under the GPLv2 or later, per WordPress guidelines.
For issues or suggestions, open an issue on GitHub.