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

feat(live-codeblock): add support for noInline to interactive code blocks #7514

Merged
merged 4 commits into from Jun 2, 2022

Conversation

jpdriver
Copy link
Contributor

@jpdriver jpdriver commented May 27, 2022

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

These changes were prompted by several new Docusaurus-based sites that Formidable is working on.

For now we've achieved this functionality by swizzling Playground, but it seemed prudent to propose contributing this back upstream so others can use it too.

Test Plan

Tests feel like they may not be required in this case (?) -- however I have included documentation updates which should adequately demo this functionality.

Test links

Deploy preview: https://deploy-preview-7514--docusaurus-2.netlify.app/docs/markdown-features/code-blocks/#imperative-rendering-noinline

Related issues/PRs

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 27, 2022
@jpdriver
Copy link
Contributor Author

p.s. I've also seen the work in #6589 which would replace react-live as the library powering Interactive Code Editors.

The noInline prop isn't required for that library -- and code samples which work correctly with this would continue to do so even if that other PR lands and you move away from React Live 😅

given that context, is it worth me opening a separate PR to update the version of react-live this project currently uses? Docusaurus is currently on react-live@2.2.3 but the latest is react-live@3.1.0.

I'd love to support that upgrade however I can if that's of interest.

@Josh-Cena Josh-Cena changed the title feat(theme-live-codeblock): add support for noInline to interactive code blocks feat(live-codeblock): add support for noInline to interactive code blocks May 28, 2022
Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

Could you fix the build failure? We're missing an optional chaining.

@Josh-Cena Josh-Cena added the pr: new feature This PR adds a new API or behavior. label May 28, 2022
@netlify
Copy link

netlify bot commented May 29, 2022

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 25f2adf
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6298038a49e1f90009b03452
😎 Deploy Preview https://deploy-preview-7514--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented May 29, 2022

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟢 92 🟢 100 🟢 100 🟢 100 🟢 90 Report
/docs/installation 🟠 84 🟢 99 🟢 100 🟢 100 🟢 90 Report

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 thanks

…index.tsx

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
@slorber slorber merged commit f25ee0c into facebook:main Jun 2, 2022
@nihgwu
Copy link

nihgwu commented Jun 8, 2022

TBH I don't like the idea of introducing render() in the doc for multi statements support, as you can see more and more doc sites are using export default App which is also supported by react-runner seamlessly, and no noInline needed, you are free to switch between inline or noInline mode, like https://www.radix-ui.com/docs/primitives/components/accordion, the source code could be runnable directly in react-runner without any change, and you can see how easy it is to integrate it https://github.com/radix-ui/website/pull/329/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants