Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdn: adapt for MDN Playground #888

Open
myfreeer opened this issue Jul 16, 2023 · 4 comments
Open

mdn: adapt for MDN Playground #888

myfreeer opened this issue Jul 16, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@myfreeer
Copy link
Member

Link: https://developer.mozilla.org/en-US/blog/introducing-the-mdn-playground/

The playground contains 2 parts, one is https://developer.mozilla.org/en-US/play, which is a standalone page with features listed below:

  • html/js/css code input with real-time highlighting
  • code format with maybe prettier
  • click to run code inside an iframe using postMessage
  • share with markdown without escaping code
  • share on server-side (should be completely removed here)

The other part is embedding inside pages using EmbedLiveSample macro like this, the structure looks like this:
image

main#content > article.main-page-content > section

image

The other structure looks like this:
image
image

Or a hidden one looks like this:
image

All these stuff make us confused, they make it really hard to connect code to the iframe, maybe we should just reuse the algorithm of from yari
It could be much better that we could process this at download time in node.js, make the inject code much simpler.

@myfreeer myfreeer added the enhancement New feature or request label Jul 16, 2023
@myfreeer myfreeer self-assigned this Jul 16, 2023
@myfreeer myfreeer added this to the v0.5 milestone Jul 16, 2023
@myfreeer
Copy link
Member Author

Since url search params are all cleaned, we should find and save id params for iframes elsewhere in pre-process, and recover it in post-process.
Also note all playground runners are exactly the same code.

@myfreeer
Copy link
Member Author

The *.mdnplay.dev host should be kept for download and process.

@myfreeer
Copy link
Member Author

See also code here

@myfreeer
Copy link
Member Author

myfreeer commented Dec 8, 2023

Another thing to do is resources inside playground code, css and html. Note that it's almost impossible to process resources inside js code without indroducing a js engine or ast walking stuff, so it's non-goal for now.
Link: https://developer.mozilla.org/en-US/blog/getting-started-with-css-container-queries/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In progress
Development

No branches or pull requests

1 participant