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

[Feature]: Horizontally scrollable output in revealjs #178

Open
ute opened this issue Mar 29, 2024 · 2 comments
Open

[Feature]: Horizontally scrollable output in revealjs #178

ute opened this issue Mar 29, 2024 · 2 comments
Labels
t: feature-request Request the addition of a new feature

Comments

@ute
Copy link
Contributor

ute commented Mar 29, 2024

Feature Description

When rendering to html, long lines of output don't get wrapped in output windows that are too small to hold them, but can be scrolled horizontally. I think this is a cool feature! 😎
It does not work on revealjs - is this on purpose? Lines get wrapped instead, and this may look somewhat funny.

Update1: I understand it is probably intended because ordinary quarto code cells behave similarly, and maybe presenters do not want to fiddle on their slides but have the whole outcome exposed to the audience.

Update2: Lines that have to be wrapped horizontally can most often be avoided by setting the width option in R.

It could thus be an extra feature:
A tiny change in qwebr-compute-engine.js, line 127 can give horizontal scrolling as in html: returning a <code> element with a simple <span> - this did the job for me.

Sorry I am pestering you with features (procrastinating urgent tasks...) - thank you for your fantastic work 😃

image

(I am not suggesting to make wraptag a code cell option. If there were such an option, it should be boolean. This was just a quick and dirty solution)

Here is what it looks like as html:
image

@ute ute added the t: feature-request Request the addition of a new feature label Mar 29, 2024
@ute ute changed the title [Feature]: Scrollable output in revealjs [Feature]: Horizontally scrollable output in revealjs Mar 29, 2024
@coatless
Copy link
Owner

coatless commented Mar 30, 2024

Sorry I am pestering you with features (procrastinating urgent tasks...) - thank you for your fantastic work 😃

@ute no worries; but, I would encourage you to knock out those tasks so we could have more focused design time 😃

A tiny change in qwebr-compute-engine.js, line 127 can give horizontal scrolling as in html: returning a <code> element with a simple <span> - this did the job for me.

On the span tag, I think we can address this without changing the output structure; but, instead, change the CSS being applied. In the early days, this was a concern of a few so we opted to have everything displayed instead of trying to mirror the R output style; but, with the work in font-sizes and other advances, I think that'll work out nicely.

@coatless coatless added this to the 4.2 milestone Mar 30, 2024
@coatless
Copy link
Owner

coatless commented Apr 5, 2024

So, I thought about this a bit more... I think the issue here will be resolved better if we change the option(width=) value away from the default of 80.

R Help documentation discussing the `width` option to control printing in R. The default length shown is 80 characters.

Default 90 width

cat("Default spacing: ", getOption("width"), fill = TRUE)

a <- 1 + 1
rep(a, 100)
Demonstration of the width parameter default causing overflow

Custom 78 width

options(width=78)
cat("Custom spacing: ", getOption("width"), fill = TRUE)

a <- 1 + 1
rep(a, 100)
Demonstration of the width parameter being reduced from 80 to 78 ensuring character output is contained

Proposed step

So, if during webR's initialization, what if we set the width option to 78? I think this would give a better resolution potentially.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: feature-request Request the addition of a new feature
Projects
None yet
Development

No branches or pull requests

2 participants