UNPKG

@remark-embedder/transformer-codesandbox

Version:
22 lines (21 loc) 903 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; const transformer = { getHTML: urlString => { const iframeUrl = urlString.replace('/s/', '/embed/'); return `<iframe src="${iframeUrl}" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>`; }, name: '@remark-embedder/transformer-codesandbox', shouldTransform: url => { const { host, pathname } = new URL(url); return ['codesandbox.io', 'www.codesandbox.io'].includes(host) && pathname.includes('/s/'); } }; var _default = transformer; exports.default = _default;