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

frontend: adds preview to html code snippets #160

Closed
wants to merge 5 commits into from
Closed

Conversation

tomtobac
Copy link
Collaborator

@tomtobac tomtobac commented May 29, 2024

Description

Adds preview to Pre component to render HTML blocks using iframes

  • Issue: OS-1985
  • Dependencies: No dependencies
image image image

AI Description

This pull request introduces a new feature that allows users to preview code blocks within an iframe.

Changes include:

  • New utility functions: addOnErrorToImg, getReconstructedHtml, and replaceCodeBlockWithIframe in preview.ts.
  • New component: Iframe in Iframe.tsx.
  • Updates to MessageContent.tsx:
    • Import isFulfilledMessage and replaceCodeBlockWithIframe.
    • Assign md based on isFulfilledMessage and replace code block with an iframe.
  • Updates to Markdown.tsx:
    • Import rehypeRaw and Iframe.
    • Add rehypeRaw to rehypePlugins.
    • Add iframe: Iframe prop.
  • Updates to package.json and package-lock.json:
    • Add rehype-raw dependency.

Cohere Hackathon 2024

Co-authored-by: Tomeu Cabot <[email protected]>
@CLAassistant
Copy link

CLAassistant commented May 29, 2024

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

codecov-commenter commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@d089057). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #160   +/-   ##
=======================================
  Coverage        ?   86.76%           
=======================================
  Files           ?      128           
  Lines           ?     4140           
  Branches        ?        0           
=======================================
  Hits            ?     3592           
  Misses          ?      548           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tomtobac tomtobac marked this pull request as ready for review June 3, 2024 11:52
@tianjing-li
Copy link
Collaborator

@misspia-cohere @wujessica would either of you have bandwidth to review this?

Copy link
Contributor

@wujessica wujessica left a comment

Choose a reason for hiding this comment

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

neat!!

@tomtobac
Copy link
Collaborator Author

tomtobac commented Jun 10, 2024

Closing in favor of #187

@tomtobac tomtobac closed this Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants