Hi,
Is it possible to highlight text in color .? For example make one line of text in to red.
Thank you
Tony D
Hi,
Is it possible to highlight text in color .? For example make one line of text in to red.
Thank you
Tony D
Hi Tony,
If you mean the text that will eventually become the content of your document, you should be able to format anything using CSS in your text elements that you want coloured, e.g. <p style="color:red">my text here</p>
There will be similar style for setting the background colour (e.g. to highlight text).
If you want coloured output from R (i.e. in the console/code output), you could try using crayon: https://github.com/r-lib/crayon
Hi Jim, Thanks for the reply
1.I want the text in Rmarkdown to be color. for example abc will make it bold.
I wonder if I can make it as red . inside the Rmarkdown environment .
2.The crayon package seem like only work in the console not in Rmarkdown output like html.
Thank you
Tony D
Yep, if you want the text to be in colour, you can use CSS/HTML styling to colour it.
"Normal" Rmarkdown text will (for the most part) end up as a HTML <p>
(paragraph) element, which you can style in a number of ways using a syntax similar to I showed in my first post.
Is that what you're looking for, or do you want the text inside your .Rmd
file to be formatted (rather than the text in your output file)?
I want colour the text in rmarkdown output html . I am using blogdown package to create blog. If I only change the html file .Every time when I refresh or add a new post. The modified html will be overwrite.
So I must change it inside rmarkdown.
Ok, I think I understand what you're trying to do. I should have specified (sorry) that you need to be editing the HTML inside your .Rmd
file, not in the .html
output file.
So in your .Rmd
file you might have something like:
Some text.
``{r}
my_answer <- my_code(data)
a_plot_of(my_answer)
``
Some other text.
Here is some text, <p style="color:red">this part of which is red!</p>
(Please accept this missing ` around the code chunk, I had to try and format it for this message board).
When you knit this to HTML, you should see the text printed out in red. You can read more about in-line HTML styling here: https://www.w3schools.com/html/html_styles.asp
Yes. that's what I am looking for. Thanks a lot
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.