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

Downlit not run on articles? #1556

Closed
hadley opened this issue Mar 10, 2021 · 14 comments · Fixed by #1792
Closed

Downlit not run on articles? #1556

hadley opened this issue Mar 10, 2021 · 14 comments · Fixed by #1792

Comments

@hadley
Copy link
Member

hadley commented Mar 10, 2021

e.g. https://googlesheets4.tidyverse.org/articles/articles/messages-and-errors.html

@maelle
Copy link
Collaborator

maelle commented Mar 11, 2021

that vignette above is about unexported helpers, I see links in e.g. https://googlesheets4.tidyverse.org/articles/articles/write-sheets.html (but maybe I'm missing something else)

@hadley
Copy link
Member Author

hadley commented Mar 11, 2021

Oh I wasn't specific enough — in (e.g.) the output of the first chunk, we don't see any of the formatting applied by cli.

@maelle
Copy link
Collaborator

maelle commented Mar 11, 2021

how should it look like?

image

@jennybc
Copy link
Member

jennybc commented Mar 11, 2021

Here are screenshots 😱 that show what the interactive experience of this styling is. Note the colors of the cli symbols and that the symbols are not the same color as the text.

Screen Shot 2021-03-11 at 10 23 04 AM

See how the main text is in white (or default color) and Sheet names are blue and worksheet or range names are green? These distinctions, between main text and styled text and between text styled 2 different ways (.file vs .field), are completely lost in this pkgdown article.

Screen Shot 2021-03-11 at 10 24 18 AM

@jennybc
Copy link
Member

jennybc commented Mar 11, 2021

It should look the same as it does in, say, examples:

https://googlesheets4.tidyverse.org/reference/range_read.html

Why do the vignettes and article not get same styling as examples? Here's another article where the messages are completely "flat".

https://googlesheets4.tidyverse.org/articles/articles/write-sheets.html

@maelle
Copy link
Collaborator

maelle commented Apr 30, 2021

I learnt today that reference building uses downlit::evaluate_and_highlight() which makes it possible to parse messages/warnings/errors.

@maelle
Copy link
Collaborator

maelle commented Apr 30, 2021

So fixing this issue might warrant adding downlit stuff in a knitr hook?

@maelle
Copy link
Collaborator

maelle commented May 3, 2021

It might even be easier to set hooks for warnings and messages.

@hadley
Copy link
Member Author

hadley commented May 3, 2021

We could do this using the same technique as hugodown (e.g. hugdown:::knit_hooks), but I think it would be quite a bit of work, and I'm not sure how it would interact with HTML widgets or other custom options that folks might be using. The current implementation is rather hacky because knitr is not quite flexible enough.

@maelle
Copy link
Collaborator

maelle commented May 20, 2021

was this/will it be somehow addressed by downlit recent changes?

@hadley
Copy link
Member Author

hadley commented May 20, 2021

It will be resolved.

@krlmlr
Copy link
Member

krlmlr commented Aug 1, 2021

FWIW I'm using https://github.com/tidyverse/tibble/blob/master/R/fansi.R as a stop gap for now.

@hadley
Copy link
Member Author

hadley commented Sep 24, 2021

If this happens will need to build README.Rmd ourselves.

@hadley
Copy link
Member Author

hadley commented Sep 27, 2021

This turned out to be much less complex than I had feared — it was mostly just turning crayon/cli on in articles, and then handling the pain of \033 in xml.

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

Successfully merging a pull request may close this issue.

4 participants