Skip to content

f/pressmind

Repository files navigation

Pressmind

Prompt-powered Gutenberg composition for WordPress.

Try Pressmind stable in WordPress Playground Try Pressmind nightly in WordPress Playground

Quick start · Security model

WordPress License Status

What Is Pressmind?

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

Highlights

  • 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/image blocks.

Demo

Local Playground

npm install
npm run playground

This 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:nightly

Hosted Playground Blueprint

This repository includes two WordPress Playground blueprints:

Open Pressmind in a fresh browser-based WordPress site:

Launch stable Playground Launch nightly Playground

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.

Quick Start

npm install
npm run build

Then 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.

Example Prompts

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.

How It Works

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]
Loading

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.

Security Model

  • 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.

Development

npm run start
npm run lint:js
npm run format
npm run build

Main files:

Status

Pressmind is experimental and intended for exploration, demos, and early feedback. Review generated code and content before publishing.

Example Output

Pressmind example output

Open the mental-health example in WordPress Playground
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.

License

GPL-2.0-or-later

Packages

 
 
 

Contributors