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

Blog post for tibble 2.0.1 #266

Merged
merged 21 commits into from
Jan 16, 2019
Merged

Blog post for tibble 2.0.1 #266

merged 21 commits into from
Jan 16, 2019

Conversation

krlmlr
Copy link
Member

@krlmlr krlmlr commented Jan 6, 2019

I'm planning to add links to documentation for the funcitons mentioned in the text, unless there's some pkgdown magic which I could use.

content/articles/2019-01-tibble-2-0-0.Rmarkdown Outdated Show resolved Hide resolved
content/articles/2019-01-tibble-2-0-0.Rmarkdown Outdated Show resolved Hide resolved
content/articles/2019-01-tibble-2-0-0.Rmarkdown Outdated Show resolved Hide resolved
content/articles/2019-01-tibble-2-0-0.Rmarkdown Outdated Show resolved Hide resolved
content/articles/2019-01-tibble-2-0-0.Rmarkdown Outdated Show resolved Hide resolved
content/articles/2019-01-tibble-2-0-0.Rmarkdown Outdated Show resolved Hide resolved
@krlmlr krlmlr changed the title Draft blog post for tibble 2.0.0 Blog post for tibble 2.0.0 Jan 7, 2019
@krlmlr
Copy link
Member Author

krlmlr commented Jan 8, 2019

@brodieG: Enabling colored HTML output using fansi::set_knit_hooks(knitr::knit_hooks, which = c("output", "error")) cripples some (but not all) tibbles in the output, see the preview at https://deploy-preview-266--tidyverse-org.netlify.com/articles/2019/01/tibble-2.0.0/. What am I doing wrong? Also, bold-faced ellipses are turned to a character in some cases.

@brodieG
Copy link

brodieG commented Jan 8, 2019

I can look at it more later, but at a glance looks like your chunk options are not right. For example, you need results="asis" and comment="" when you set the hooks. If you can, try to match what vignette('sgr-in-rmd', package='fansi') does exactly. In particular this. If that doesn't work let me know and I'll try to debug, but probably can't get to it till this evening US East Coast time.

@krlmlr
Copy link
Member Author

krlmlr commented Jan 8, 2019

Thanks. This does change the output, but unfortunately doesn't help here:

screenshot from 2019-01-08 17-46-44

@brodieG
Copy link

brodieG commented Jan 8, 2019

I tried just building the document with rmarkdown::render and it worked for me:

image

I'm guessing its a CSS conflict of some sort, unless maybe you don't have the latest version of fansi. I'll have to download and build your whole site so I can see why it works as a standalone RMD file for me, but not for you. The example above is a little modified to test the colors are actually being put in.

One other thing that would be helpful: can you report what crayon::num_colors() produces for you?

@krlmlr
Copy link
Member Author

krlmlr commented Jan 8, 2019

crayon reports 256 colors, I have fansi 0.4.0 on my system.

The site is rendered using blogdown::serve_site(), you may need to touch the .Rmarkdown file to initiate the process.

I don't understand why the problem happens with some but not all tibbles in the output. I'll turn off colors as a stop gap, perhaps we can find a solution and update the blog post later.

@krlmlr
Copy link
Member Author

krlmlr commented Jan 8, 2019

What's the timeline for merging and communicating this?

There's no need to rush, binaries for some platforms haven't been built yet. I'm planning a 2.0.1 release fairly soon, but I'd like to wait before all binaries are built.

@krlmlr krlmlr changed the title Blog post for tibble 2.0.0 WIP: Blog post for tibble 2.0.0 Jan 8, 2019
@krlmlr
Copy link
Member Author

krlmlr commented Jan 8, 2019

OTOH, I think the binaries for R-release and R-devel will never be built due to the incompatibility with rlang 0.3.1. Let's wait for tibble 2.0.1 then.

@brodieG
Copy link

brodieG commented Jan 9, 2019

Rename your file *.Rmd, not *.Rmarkdown. I believe the latter triggers a blackfriday or some such markdown->html translation, which #?##! gratuitously substitutes HTML line breaks for new lines. If you use Rmd I think you get the normal pandoc conversion directly to HTML.

I am not 100% certain this is what's happening because debugging the blogdown -> knitr -> rmarkdown -> pandoc chain (or any permutations of them) is about as pleasant and easy as pulling my nails out with wooden spoons and since the change was enough to make it work for me I do not want to spend one additional second confirming the exact nature of the failure. However, this seems very likely because using Rmarkdown files leave .markdown artifacts, whereas using Rmd files leave html artifacts.

Please let me know if the change does not fix it for you. I really really hope it does since I was both able to reproduce the problem and fix it by making the change.

@hadley
Copy link
Member

hadley commented Jan 9, 2019

@krlmlr there's no rush, but at the same time, I don't think including coloured output is that important if it requires a very different setup to the rest of the blog.

@brodieG ah bummer — we deliberately use .Rmarkdown because if we use .Rmd we don't get an internal table of contents. Thanks for looking into it, and I 100% empathise with the pain of testing when you have this complicated combination of tools.

@brodieG
Copy link

brodieG commented Jan 9, 2019

I don't have the courage to mess with blackfriday, but it does look like there is an option that might be causing the problem:

image

What's concerning though is that it is off by default, so if it is indeed this it was presumably turned on for some reason.

That aside, it is possible to have TOCs in Rmd. If the positioning of the existing TOC in the sidebar is CSS, then it should be possible to do the same with the Rmd generated one. If not looks like Garrick has examined the problem.

But I agree with @hadley that this is not worth doing, especially when the colors in this case are so subtle.

@krlmlr krlmlr changed the title WIP: Blog post for tibble 2.0.0 Blog post for tibble 2.0.1 Jan 13, 2019
@krlmlr
Copy link
Member Author

krlmlr commented Jan 13, 2019

I tweaked a bit for 2.0.1, should be ready to go.

Thanks again Brodie for looking into it, sorry for the pain. In the long run I'd love to see color in console output. Would it work if fansi::set_knit_hooks() generated HTML without newlines? A manual TOC or setting blackfriday options also seem worth investigating.

@krlmlr
Copy link
Member Author

krlmlr commented Jan 13, 2019

Coloring works now, examples look good to me.

@hadley hadley merged commit d2a4771 into tidyverse:master Jan 16, 2019
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 this pull request may close these issues.

3 participants