Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified

Embed Frame Markup

Exports a single default function which, when invoked with an object containing one or more of body, styles, scripts, returns a generated page markup including those assets. Scripts and styles should be passed as objects reflecting the response structure from the GET /sites/%s/embeds/render or GET /sites/%s/shortcodes/render endpoints.

WARNING: You should be extremely careful when using this module, and it should only be used when you're certain that user input is properly sanitized and/or the generated output is used in a sandboxed context. If in doubt, you should probably avoid using this utility.

Usage

import generateEmbedFrameMarkup from 'calypso/lib/embed-frame-markup';

const markup = generateEmbedFrameMarkup( {
    body: 'Hello World',
    styles: {
        'jetpack-carousel': {
            src: 'https://s1.wp.com/wp-content/mu-plugins/carousel/jetpack-carousel.css?m=1458924076h&ver=20120629',
            media: 'all',
        },
    },
    scripts: {
        'jetpack-facebook-embed': {
            src: 'https://s2.wp.com/wp-content/mu-plugins/shortcodes/js/facebook.js?ver',
            extra: 'var jpfbembed = {"appid":"249643311490"};',
        },
    },
} );

console.log( markup );
// -> '<html>…</html>'