-
Notifications
You must be signed in to change notification settings - Fork 15
Use console and Rconsole fenced code blocks for input/output examples #232
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
base: main
Are you sure you want to change the base?
Conversation
Hi @hturner, |
terminal. And there we go!!! We have setup our R Dev Container locally. | ||
|
||
9. The container will be closed when you close VSCode. To reopen the container, | ||
open the `r-dev-env` directory in VSCode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put the new code block after the first sentence in step 8 and before "And there we go!!!".
Step 9 (deleted lines 63 and 64) should not have been deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this might have gotten deleted after running the linter is what Im thinking
will correct this.
```console | ||
$ echo $BUILDDIR | ||
/workspaces/r-dev-env/bin/R | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old screenshot showed both input and output in the bash terminal, so you should use a console
block rather than a bash
block, and include both the bash command and the output (in future cases you may need to work through the tutorial to get the correct output!). Don't forget to prefix bash commands with the command prompt $
(ideally we could use /workspaces/r-dev-env (devel) $
as the full prompt, but the syntax highlighter then gets confused with bash commands that include dollar signs, so stick with a simple $
prompt).
The syntax highlighting we get with the Material theme doesn't look very different for console
blocks, so I have committed some custom CSS to style the input differently from the output (input is black, output is grey) and to make the prompt symbol clearer (coloured blue). For inputs, I have applied the same styling to bash
blocks, for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case it is unclear - I corrected lines 63 - 66 when adding the custom CSS, so the code block is now correct, it just needs moving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Heather, I understand what you mean!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for requesting a review of these initial changes - I've made some comments which should be helpful for finalising the pages you have started work on and updating further help pages.
I notice the list numbering is not correct in container_setup/local_setup/localsetup.md
because the code blocks and text have not been indented correctly. It is probably best to address this in a separate PR, so we can focus on getting the code block right.
```Rconsole | ||
hist(rnorm(1000)) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rconsole blocks are for displaying input and output in an R session, similar to console blocks for sessions in a bash terminal. You need to include the prompt for input lines so that syntax highlighting is applied, i.e.
> hist(rnorm(1000))
However, an Rconsole block is not suitable in the case. The screenshot is intended to show the R script file, the hist(rnorm(1000))
command sent to the R terminal and the histogram in the plot window. Unfortunately, the screenshot here is wrong, it shows source("/workspaces/r-dev-env/R/test.R", encoding = "UTF-8")
, which is the result of running Cmd/Ctrl + Shift + s
not Cmd/Ctrl + enter
, which is the short-cut we wish to document. You could fix this at the same time as the code fencing or open a separate issue about this.
Description
container_setup/local_setup
and replaced it with a fenced code block showing the relevant terminal command and output.tutorials/running_r
, replaced the last image with the corresponding R code example using anRconsole
fenced code block.These changes improve accessibility and maintainability by using code fencing for input/output examples instead of screenshots.
(closes #210)