Skip to content

Add RawHTML Component #497

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

Merged
merged 19 commits into from
May 9, 2023
Merged

Add RawHTML Component #497

merged 19 commits into from
May 9, 2023

Conversation

andersy005
Copy link
Member

In this PR, I added a RawHTML component that can render any arbitrary HTML content (such as Xarray dataset Repr, hvplot plots, etc.) and included utilities for sanitizing the HTML. This component allows users to include HTML files directly in their markdown.

In addition, I also considered different options for producing HTML content and found that allowing users to write HTML files via Python is one of the easiest options. To demonstrate this, I included an example of how the user can write an HTML file using Python code and then include it in their markdown using the RawHTML component.

import xarray as xr
ds = xr.tutorial.open_dataset(...)
with open('public/posts/foo/ds.html') as f:
   f.write(ds._repr_html_())
<RawHTML filePath='/public/posts/foo/ds.html' />

@vercel
Copy link

vercel bot commented Apr 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
xarray-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2023 4:38pm

@andersy005
Copy link
Member Author

@jhamman, please take a look at this and let me know what you think whenever you get a chance.

Here's the live component: https://xarray-dev-git-add-html-repr-xarray.vercel.app/blog/introducing-xwrf

* origin:
  Bump apexcharts from 3.37.3 to 3.40.0 (#514)
  Bump glob from 9.3.0 to 10.2.2 (#512)
  Bump d3 from 7.8.3 to 7.8.4 (#509)
  [pre-commit.ci] pre-commit autoupdate (#513)
  Bump @next/mdx from 13.2.4 to 13.3.4 (#516)
  Bump framer-motion from 10.10.0 to 10.12.5 (#515)
  Bump playwright from 1.32.1 to 1.32.3 (#504)
  Bump eslint-config-next from 13.2.4 to 13.3.0 (#500)
  Bump @chakra-ui/icons from 2.0.17 to 2.0.18 (#502)
  Bump next from 13.2.4 to 13.3.0 (#498)
  Bump swr from 2.1.0 to 2.1.3 (#499)
  separate prerun installation and prerun-code (#503)
@andersy005 andersy005 marked this pull request as ready for review May 8, 2023 17:10
@andersy005
Copy link
Member Author

@jhamman, please take a look at this and let me know what you think whenever you get a chance.

Here's the live component: xarray-dev-git-add-html-repr-xarray.vercel.app/blog/introducing-xwrf

@jhamman, the gentlest of bumps on this :)

Copy link
Contributor

@jhamman jhamman left a comment

Choose a reason for hiding this comment

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

@andersy005 - thanks for the ping! I totally missed this the first time. This looks great. Let's get it in for #405.

@andersy005 andersy005 merged commit 0daa8a7 into main May 9, 2023
@andersy005 andersy005 deleted the add-html-repr branch May 9, 2023 17:04
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.

Add component for Xarray's HTML REPR
2 participants