gatsby-remark-embedded-codesandbox icon indicating copy to clipboard operation
gatsby-remark-embedded-codesandbox copied to clipboard

Feature: Support large sandbox content

Open karlhorky opened this issue 6 years ago • 1 comments
trafficstars

If the content passed to the GET define API is too large, CodeSandbox will return an HTTP 414 error (URI Too Long).

fetching the POST define API with ?json=1 (the "Define without Render" option) and then using the resulting URL for the iframe would be a workable solution:

https://codesandbox.io/docs/importing#xhr-request

This would require running asynchronous code within the transformer function, which can be achieved by returning a promise:

https://github.com/swimlane/DocSPA/blob/9155c2e07fa3105f4e7858e62e9877cfc4105706/projects/swimlane/docspa-remark-preset/src/plugins/short-codes.ts#L106

More information about async remark plugins: https://github.com/gatsbyjs/gatsby/issues/16403

karlhorky avatar Aug 06 '19 09:08 karlhorky

I may end up implementing a PR of this myself, if I need it quick enough.

karlhorky avatar Aug 06 '19 09:08 karlhorky