NIEHS / amadeus

https://niehs.github.io/amadeus/
Other
2 stars 2 forks source link

pkgdown code not copyable #99

Closed kyle-messier closed 2 weeks ago

kyle-messier commented 3 weeks ago

Code in deployment should be copyable

The source code readme (https://github.com/NIEHS/amadeus/) is copyable. For example the line

pak::pak("NIEHS/amadeus")

can be copied for ease of implementation. However, the pkgdown deployment is not at https://niehs.github.io/amadeus/

Maybe this is standard, but it would be nice.

sigmafelix commented 3 weeks ago

I found all code blocks in README.md were generic (i.e. starting with "```" not "```r"). It might be related to the problem. I will check it somewhere else and make a PR to Mitchell's branch with my changes that were pushed after the last PR.

mitchellmanware commented 2 weeks ago

I think this happened as a result of not wanting to run the download chunks in the building of the package which runs the README.md file. I can fix these

mitchellmanware commented 2 weeks ago

I think the lack of copy-paste functionality in the README page is default functionality. This thread discusses the copy-paste button in the function reference pages (which is enabled in our webpage), but no discussion of README.

I updated the README to separate code chunks from return messages, which now enables the copy-paste button in the source code readme without running the code.

Is this sufficient, or do we want to actually run the code blocks? @sigmafelix @kyle-messier

Screenshot 2024-07-10 at 7 41 11 AM
sigmafelix commented 2 weeks ago

I think the issue is in the pkgdown page. The current amadeus webpage displays code blocks without copy-and-paste functionality: https://niehs.github.io/amadeus

image

In contrast, all code blocks in beethoven webpage have the functionality (to note, copy buttons show up upon hovering the cursor on a code block): (https://niehs.github.io/beethoven) The difference between README.md source of amadeus and that of beethoven is that the backtick symbols are followed by "r" or nothing.

image

https://github.com/NIEHS/beethoven/blob/9e4daf19e69c2a099f5b9471da96ce2a3c5cd942/README.md?plain=1#L9-L20

My quick experiment in one of my repos shows this. https://sigmafelix.github.io/speed/

mitchellmanware commented 2 weeks ago

@sigmafelix Ahh, yes I see.

r has been added to code blocks with code but not output (https://github.com/NIEHS/amadeus/commit/2967113fe6f8659a25431fd2fc18b8d81e01f3e5).