Forem Creators and Builders 🌱

Discussion on: [REQUEST] Allow embedding CodeSandbox from GitHub urls

Collapse
 
link2twenty profile image
Andrew Bone

Looking at it there are 4 things we need to tell the codesandbox tag in order to get this to work.

We need to tell it:

  • this is github and so not to expect an ID.
  • which repository we're looking for, modularcoder/tutorial-react-tree-menu
  • which branch to use, tree/master
  • which folder to start in, stage4-react-router

The codesandbox tag differs from the jsfiddle and codepen variants in that it only accepts an ID and won't try and work it out from the URL.

I think if we were to add this functionality we would want to be able to take a full URL and extrapolate from that.

Collapse
 
modularcoder profile image
Gevorg Harutyunyan • Edited

What about adding support for these type of ids to validation?

github/{userName}/{repoName}[/optional/part/to/dir]
Enter fullscreen mode Exit fullscreen mode

So wondering if extending codesandbox ID validation regexp will make it work
github.com/forem/forem/blob/master...

Collapse
 
modularcoder profile image
Gevorg Harutyunyan

After looking ad liqud _codesandbox partial render, I suppose if just the tag regexp validation would be extended, this might work out of the box.

github.com/forem/forem/blob/master...

So basically it would be allowing github/{whatever} type of ids validation