Skip to content

live-codes/wordpress-livecodes-embed

Repository files navigation

LiveCodes Embed — WordPress Plugin

Embed LiveCodes playgrounds in WordPress posts and pages by pasting a URL.

What it does

  • Registers livecodes.io (and its versioned subdomains) as a trusted oEmbed provider. This matters: embeds resolved via oEmbed discovery get sandboxed iframes (sandbox="allow-scripts" security="restricted"), which breaks interactive playgrounds. Registered providers are trusted and skip sanitization.
  • Adds a LiveCodes variation of the core Embed block to the block inserter.

Usage

Paste a LiveCodes URL (e.g. a share URL like https://livecodes.io/?x=id/...) on its own line in the editor. Done.

Self-hosted instances

add_filter( 'livecodes_embed_url_pattern', function () {
    return '!^https?://livecodes\.example\.com/.*$!i';
} );
add_filter( 'livecodes_embed_provider_endpoint', function () {
    return 'https://livecodes.example.com/oembed';
} );

Development

Requires Docker and Node.

npx @wordpress/env start          # WordPress at http://localhost:8888 (admin / password)
npx @wordpress/env run cli wp plugin install plugin-check --activate
npx @wordpress/env run cli wp plugin check livecodes-embed

Building the distribution ZIP

Zip the plugin excluding everything listed in .distignore:

mkdir -p dist/livecodes-embed
cp livecodes-embed.php editor.js readme.txt LICENSE dist/livecodes-embed/
cd dist && zip -r livecodes-embed.zip livecodes-embed

Releasing

Publishing a GitHub release triggers .github/workflows/deploy.yml, which deploys to WordPress.org SVN (requires SVN_USERNAME / SVN_PASSWORD repository secrets). Keep Version in livecodes-embed.php, Stable tag in readme.txt, and the git tag in sync.

License

MIT

About

A WordPress plugin to embed LiveCodes playgrounds

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages