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

Quarto website: Set fixed column widths for Arguments section? #306

Closed
grantmcdermott opened this issue Feb 4, 2025 · 15 comments · Fixed by #308
Closed

Quarto website: Set fixed column widths for Arguments section? #306

grantmcdermott opened this issue Feb 4, 2025 · 15 comments · Fixed by #308

Comments

@grantmcdermott
Copy link

Subtitle: wrapping of long argument lists.

Hi folks,

This is a slightly difficult issue to describe, but easy to visualize. So let me first direct you over to the rendered webpage that prompted my question: https://grantmcdermott.com/tinyplot/man/tinyplot.html#arguments

Image

As you can (hopefully) see, there is a large whitespace gap between the function arguments (x, y, etc.) and their respective descriptions ("the x and y arguments provide the x and y coordinates for the plot.", etc.) Indeed, the description column here is very thin.

If you scroll further down the page, you'll see that the culprit is the very last subset, na.action, drop.unused.levels entry right at the bottom of the Arguments section. This long entry doesn't get wrapped and so all of the explanation text in the next column is pushed over to the right.

Question: Is there are way to enforce max column widths of these respective column, and/or ensure wrapping so that we don't end up with excessive whitespace and squished description columns?

FWIW wrapping automatically takes place in the R console if you look at same help page locally (here: with ?tinyplot in RStudio).

Image.

Thanks for taking a look and apologies if I'm overlooking something obvious.

@vincentarelbundock
Copy link
Collaborator

vincentarelbundock commented Feb 4, 2025

Quick response before going to work.

  1. The nowrap setting is essential for the vast majority of packages, because altdoc used to do the weirdest breaks for single argument names.

  2. FWIW, I actually think that tinyplot should split the arguments on separate lines. I know this is Base style, but I personally think it displays badly both online and in the pdf.

  3. An immediate solution would be to sed this string out of the man pages before uploading the website: white-space: nowrap;.

For reference, nowrap is added here: https://github.com/vincentarelbundock/altdoc/blob/c50ebef035e81aeb225f68fa27d7e9c86387268a/R/rd2qmd.R#L22

@etiennebacher
Copy link
Owner

etiennebacher commented Feb 5, 2025

I don't think we have a better solution than point 3. One could override the CSS with white-space: collapse but it would be applied to the whole website (therefore defeating point 1) and I think currently it would be hard to apply it just to man pages, so I'm closing this.

Thanks for the detailed answer, Vincent.

@etiennebacher etiennebacher closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2025
@grantmcdermott
Copy link
Author

Thanks both.

Just so I understand, for 2 is the suggestion to duplicate the description for each newline argument? I'm not sure how to make multiple argument entries inherit the same description block otherwise...

I'll think on a custom post processing command to add to the GA workflow file for 3.

@etiennebacher
Copy link
Owner

For reference, nowrap is added here: vincentarelbundock/altdoc@c50ebef/R/rd2qmd.R#L22

Actually I think we could change nowrap to collapse and it would give this:

Image

@vincentarelbundock do you have some examples in mind where altdoc was weirdly wrapping arg names? I could test those to see if they play nicely with collapse.

@vincentarelbundock
Copy link
Collaborator

that looks interesting.

but sorry, no, it was too long ago and I forgot. My guess is packages with dots in variable names will be especially vulnerable

@etiennebacher
Copy link
Owner

Ok I'll do a mock package to try this out

@grantmcdermott
Copy link
Author

Well, tinyplot does have lots of dots in names (a bitter base R convention I had to swallow for the sake of consistency) 😏

So if it doesnt show up there we might be okay.

@etiennebacher etiennebacher reopened this Feb 7, 2025
@etiennebacher
Copy link
Owner

etiennebacher commented Feb 7, 2025

Here's with #308:

  • quarto

Image

  • docute

Image

  • docsify

Image

  • mkdocs

Image


With nowrap (current situation), with quarto only:

Image

WDYT?

@etiennebacher etiennebacher changed the title Quarto webite: Set fixed column widths for Arguments section? Quarto website: Set fixed column widths for Arguments section? Feb 7, 2025
@etiennebacher
Copy link
Owner

I'm moving forward with this because it's easier to test on multiple existing packages than keeping the change in a PR. If something breaks, we can always revert it before releasing.

@grantmcdermott
Copy link
Author

Super, thanks @etiennebacher. I'll update to the dev version of altdoc for tinyplot and LYK if I notice any red flags.

BTW is the preferred way to do this now (i.e., Suggest a remote package) via R-universe?

@etiennebacher
Copy link
Owner

BTW is the preferred way to do this now (i.e., Suggest a remote package) via R-universe?

I had no idea one could do that, I always keep a Remotes field only (this also reminds me to check if the dependency has been updated before I do a release).

@grantmcdermott
Copy link
Author

Got it, thanks. I just saw that the R-universe approach is failing anyway, since the altdoc build hasn't updated passed 0.5.0.

@grantmcdermott
Copy link
Author

(As an aside, the R-universe approach might be a nice solution for tidypolars if you want to get that on CRAN with the polars/neo-polars dependency remaining on R-universe.)

@etiennebacher
Copy link
Owner

etiennebacher commented Feb 27, 2025

Great idea! That didn't even cross my mind but it would be great to have it on CRAN, thanks 👍

I have to read more about this, it sounds a bit weird to me that a package can be on CRAN and its dependencies on R-universe but not on CRAN. I remember the CRAN team being very sensitive about downloading external dependencies so I'm surprised it's that "easy" to bypass.

@grantmcdermott
Copy link
Author

P.S. The updated tinyplot website looks great, thanks! https://grantmcdermott.com/tinyplot/man/tinyplot.html#arguments

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 a pull request may close this issue.

3 participants