Reputation: 8841
I frequently need to paste a code section into a Markdown document and then I want to change some color in the text.
For example:
This is a code sample:
```
#include <stdio.h>
int main(void) {
printf("Hello World!\n");
return 0;
}
```
How can I set the text string "Hello World!" to the color red? I wish to use it as a code block since I don't want to reformat it to Markdown style.
Upvotes: 15
Views: 30333
Reputation: 909
Another way is to use HTML.
If you want to apply colours independently of a computing language.
<div style="color:red; background:lightgrey">
<code>
I want to have this text in red on grey.
</code>
</div>
That gives me good results. I use it in Joplin.
Upvotes: 2
Reputation: 321
You can't put color on it.
Try putting C like this:
```c
#include <stdio.h>
int main(void) {
printf("Hello World!\n");
return 0;
}
```
It will make your text seems as code.
Upvotes: 22