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

Render plain-text without quotations #103

Merged
merged 2 commits into from
Feb 27, 2023

Conversation

agoose77
Copy link
Collaborator

Fixes #99

I'm not hugely familiar with React, so I'm not sure if this fully respects dependencies.

@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch agoose77/jupyterlab-myst/feat-text-renderer

@agoose77 agoose77 changed the title wip: split rendering into plain-text vs non plain-text feat: split rendering into plain-text vs non plain-text Feb 27, 2023
@agoose77 agoose77 marked this pull request as ready for review February 27, 2023 20:34
@rowanc1 rowanc1 added the enhancement New feature or request label Feb 27, 2023
@rowanc1 rowanc1 changed the title feat: split rendering into plain-text vs non plain-text Render plain-text without quotations Feb 27, 2023
const rendermime = (cell?.parent as StaticNotebook).rendermime;
function PlainTextRenderer({ content }: { content: string }) {
content = content.replace(/^(["'])(.*)\1$/, '$2');
return <span>{content}</span>;
Copy link
Member

Choose a reason for hiding this comment

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

We might want this a bit fancier in the future, e.g. style + alt-text hover with the expression used to create it, but for now this is great!

@rowanc1
Copy link
Member

rowanc1 commented Feb 27, 2023

This looks good to merge in @agoose77 as soon as tests pass -- I know that @fperez was looking for this asap, so we could also consider another patch release.

@agoose77 agoose77 merged commit a942911 into jupyter-book:main Feb 27, 2023
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
None yet
Development

Successfully merging this pull request may close these issues.

Rendering text dynamically via {eval} returns single quoted output of strings.
2 participants