daaronr / dr-rstuff

Helper files and functions David Reinstein uses across various data projects
0 stars 0 forks source link

Improvements to bookdown formats -- see 'issue' discussion #3

Open daaronr opened 3 years ago

daaronr commented 3 years ago
daaronr commented 3 years ago

@oskasf This is now a pretty high priority, but more in terms of a 'Profusion Data Academy spinoff'. I got some feedback on the presentation of that bookdown, and I'll start that as a new issue.

daaronr commented 3 years ago

@oskasf Can you check out and help out a bit with the formatting and building in 'metrics_notes'?

image

daaronr commented 3 years ago

@oskasf Turned the above list into tick-boxed we can check when done

Maybe each of these should be a separate issue but they tend to be interconnected

Added: - [ ] Make 'hide code' the default ... have the button say 'show code'

In most cases people seeing these will prefer 'no code' and be overwhelmed by code, and may not even realise they can hide it

oskasf commented 3 years ago

"Make hide code the default" - Note to self see here, here and here

daaronr commented 3 years ago

image

The button looks good, but code is hidden and pushing the button doesn't do anything @oskasf. Perhaps its something to do with other settings I have in the project? Can you try to see if you can get it working in one of the actual projects?

oskasf commented 3 years ago

I had this working in metrics_discussion yesterday. Which project are you trying it with?

daaronr commented 3 years ago

Was working in a (private Repo) Rethink Priorities project. Now its working for me for the Metrics bookdown, at least, so I'll look for differences between the two projects, thanks!

daaronr commented 3 years ago

@oskasf in metrics_discussion_work, I think some of the things in the index file are also done in project_setup.R. Could you check for and remove duplication when you get a chance?

daaronr commented 3 years ago

OK @oskasf the 'hide code by default' is [correction 'now'] working in that bookdown. It was the line

knitr::opts_chunk$set(echo = FALSE, warning= FALSE)

that was messing it up (that hides all code, not even allowing any folding)

oskasf commented 3 years ago

@daaronr I only saw one particular chunk of code which was duplicated in metrics_discussion, have removed this now.

Does removing that line fix the code hiding or is it still broken?

daaronr commented 3 years ago

Sorry, my previous message had an error. It now IS working :)

daaronr commented 3 years ago

Wait, it is now showing code by default in the Bookdowns I've been working on. @oskasf can you point me to the code line that determines this?

oskasf commented 3 years ago

@daaronr So the approach is a bit involved. I followed the advice here and incorporated this into bookdown_template/support/header.html This does look quite involved however it was seemingly the only way to do this (much easier to show all by default and then hide than the other way around).

daaronr commented 3 years ago

It's still seems to be showing, not hiding code by default and I'm using the latest header. Is it doing the same for you @oskasf ?