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

Use CH.Code component for notebook in-out pairs #752

Open
wants to merge 1 commit into
base: uarray-intro
Choose a base branch
from

Conversation

gabalafou
Copy link
Contributor

@gabalafou gabalafou commented Jul 16, 2023

This PR is on top of #647.

This is an attempt at fixing #679.

In trying to find a way to format notebook code cells with input and output stacked on top of each other, I couldn't find any kind of Remark plugin or other tool that would easily fit within our current blog post build system (mdx + remark + code-hike).

But I discovered the panels feature by Code Hike, which might meet our needs.

The syntax looks like this:

<CH.Code className="hide-ch-frame-buttons">

```python in
print('hello, world')
```

---

```txt out
hello, world
```

</CH.Code>

And the result looks like this, when rendered in HTML on our website:

screenshot of rendered Code Hike cell

@vercel
Copy link

vercel bot commented Jul 16, 2023

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

Name Status Preview Updated (UTC)
consulting ✅ Ready (Inspect) Visit Preview Jul 16, 2023 5:22pm
labs ✅ Ready (Inspect) Visit Preview Jul 16, 2023 5:22pm

@pavithraes
Copy link
Member

@gabalafou Thank you, I think this does work quite well for us! 🌻

Blog post preview here for quick ref: https://labs-git-ch-code-uarray-quansight.vercel.app/blog/uarray-intro

We'll need to add a note about this in the README for blog post authors.

And, as s a style preference, I'd suggest we use and encourage descriptive panel headings like below. What do you think?

<CH.Code className="labs-blog-cell-in-out">

```python myscript.py
print('hello, world')
```

---

```txt Output:
hello, world
```

</CH.Code>

Copy link
Member

@trallard trallard left a comment

Choose a reason for hiding this comment

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

I cannot remember why this was blocked or not merged. But this looks like a reasonable fix. I will approve this and leave it to @pavithraes and @gabalafou to merge then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants