Prompt-powered Gutenberg composition for WordPress.
Pressmind is an experimental WordPress plugin that turns natural language prompts into real Gutenberg blocks. It reads the current post context, streams model output in the editor, and replaces the prompt block with generated content.
It can create static layouts, rich HTML, SVG diagrams, org charts, tables, callouts, sandboxed interactive widgets, and Media Library-backed AI images.
The bigger goal is to make New York Times-style interactive posts approachable inside ordinary WordPress. Visual explainers, animated SVG diagrams, scrollytelling sections, and small playable widgets that newsrooms usually hand-build per article can be composed uniquely per post in the Gutenberg editor with AI support, instead of from a fixed template.
pressmind-demo.mp4
Watch the demo video
- Context-aware generation: Sends bounded post context so generated blocks match the current article.
- Streaming editor feedback: Shows model output while the backend is generating.
- Real Gutenberg output: Returns serialized block markup and inserts parsed blocks into the editor.
- Smart rendering mode: Keeps simple HTML/SVG as
core/html; moves scripts/styles into an isolated sandbox block. - Editable generated blocks: Refine selected HTML or sandbox blocks with AI using the existing code as context.
- Sandboxed interactivity: Games, calculators, and scripted UI render in an iframe with no same-origin access.
- Optional image generation: Generates images with OpenAI Images, imports them into the Media Library, and inserts
core/imageblocks.
npm install
npm run playgroundThis builds the block assets and starts a local WordPress Playground instance with auto-login on the latest stable WordPress build.
To test against WordPress nightly for upcoming WordPress 7.0 APIs such as Connectors:
npm run playground:nightlyThis repository includes two WordPress Playground blueprints:
blueprint.json: stable demo using the latest released WordPress build.blueprint-nightly.json: nightly demo for testing upcoming WordPress 7.0 APIs such as Connectors.blueprint-mental-health.json: opens the mental-health interactive news example as a Gutenberg post.
Open Pressmind in a fresh browser-based WordPress site:
Both blueprints enable networking, log into wp-admin, install Pressmind from GitHub, activate the plugin, and open a new post.
That post is imported from examples/pressmind-demo-post.html and includes prefilled Pressmind prompt placeholders. They are not sent to AI until you click Generate Blocks.
For a fully generated longform example, see examples/mental-health-interactive-news.html. It mimics Pressmind output for an interactive mental-health news feature with custom HTML, inline SVG, sandboxed charts, a playable breathing exercise, and resource guidance.
npm install
npm run buildThen install the plugin in WordPress and activate Pressmind.
Go to Settings > Pressmind and configure:
- Credentials source: WordPress Connector or Pressmind custom settings
- Connector selection or custom API key/endpoint fields
- Text model
- Optional image generation model and size
On WordPress 7.0+, Pressmind can use API keys from the new WordPress Connectors API. If multiple API-key AI connectors are registered, choose one in Settings > Pressmind. Connector mode hides the custom API key and endpoint controls, but still lets you choose the model name. Choose Custom settings to show and use Pressmind’s own API key and endpoint fields instead.
Create a comparison table from this post.
Generate an accessible SVG org chart for the teams described here.
Build a sandboxed tic-tac-toe game with modern styling.
Generate a hero image for this post and insert it with a caption.
flowchart LR
PromptBlock[Pressmind Block] --> RestAPI[WordPress REST API]
RestAPI --> Model[AI Model]
Model --> RestAPI
RestAPI --> Parser[Block Parser]
Parser --> Editor[Gutenberg Editor]
RestAPI --> Media[Media Library]
The backend asks the model for strict JSON with:
summary: A short editor-facing description.serializedBlocks: Valid serialized Gutenberg block markup.assets: Optional generated media requests.warnings: Safe fallbacks or limitations.
- API keys are stored in WordPress options and used only server-side.
- REST endpoints require the current user to be able to edit the target post.
- Returned block markup is parsed, allowlisted, and sanitized before insertion.
- Static HTML and SVG use a conservative allowlist.
- Scripted or style-tagged content is isolated in
pressmind/sandbox. - Sandbox iframes use
sandbox="allow-scripts"without same-origin access. - Generated images are imported into the WordPress Media Library before insertion.
npm run start
npm run lint:js
npm run format
npm run buildMain files:
pressmind.php: Plugin bootstrap and dynamic sandbox block rendering.includes/class-settings.php: Admin settings.includes/class-ai-provider.php: AI and image provider calls.includes/class-rest-controller.php: REST generation and streaming.src/ai-prompt-block/: Block editor UI.examples/pressmind-demo-post.html: Playground demo post content.examples/mental-health-interactive-news.html: Full generated article example with static visuals and sandboxed interactions.
Pressmind is experimental and intended for exploration, demos, and early feedback. Review generated code and content before publishing.
A New York Times-style interactive feature, uniquely composed inside the Gutenberg editor with AI support. Loads examples/mental-health-interactive-news.html as a Gutenberg post in a fresh Playground site.
GPL-2.0-or-later
