DEV Community

kanta13jp1
kanta13jp1

Posted on

Shipping a 17.9 KB WordPress Plugin That Lets AI Tools Copy Clean Markdown

When readers paste a technical article from WordPress into an AI assistant, they rarely want theme sidebars, navigation menus, or Cookie banners. They want the heading structure, fenced code blocks, and links cleanly preserved as Markdown.

To solve that cleanly without adding heavy runtime dependencies, we built and open-sourced copy-markdown-for-ai for WordPress.

What the Plugin Does

Instead of scraping rendered HTML with complex client libraries at every page load, the plugin renders a compact action bar (.cmfai-bar) alongside post content with direct copy and download actions:

  • One-click Markdown copy: Copies structured article content to the clipboard and switches button state (is-copied / Copied Markdown to clipboard.).
  • Direct .md download: Downloads a clean Markdown file named from the post slug (for example, hello-world.md at 179 bytes on a default test post).
  • Zero-bloat packaging: All store icons, banners, src/, node_modules/, and CI files stay outside the distribution archive via .distignore.

Verification Before Submission

Before submitting to the WordPress.org Plugin Directory, we ran three concrete checks:

  1. Automated CI (Run 46810041142): php-lint, build-and-lint, and WordPress/plugin-check-action@v1.1.9 all passed cleanly.
  2. WordPress Playground Live Check: Verified in a real browser (HTTP 200, 4 buttons rendered, clipboard feedback verified, .md download verified, 0 console JS errors).
  3. Archive Size & Contents: The distributable copy-markdown-for-ai.zip weighs 17,922 bytes across 18 entries (copy-markdown-for-ai.php, includes/, build/, readme.txt, uninstall.php).

Source Code

The MIT/GPL-compatible WordPress plugin source is public on GitHub:
https://github.com/kanta13jp1/copy-markdown-for-ai

How are you making your documentation or blog posts easier to reuse with AI tools—do you expose raw .md endpoints, llms.txt, or UI copy buttons?

Top comments (0)