1

I am making a website using GitHub Pages and would like to display output code with a white background rather than the default gray background for code elements (but keep the monospaced font).

In my index.md file, I've tried adding an inline HTML block to deal with this, since GitHub-flavored Markdown doesn't allow you to change the background for code elements. I used the following code:

<pre><span style="display:block; background-color:white"><code>## Constructed an OTU  table and other variables with the following settings:
## thresh_prevalence: 80
## thresh_abundance: 0.5
## thresh_NA: 5
## subj: subject_1
</code></span></pre>

But the output does not have a white background. It instead has the default background color:

It seems that styles are not whitelisted in the GitHub-flavored version of Markdown. Is there a way to change the background color of a code block without style tags, or without HTML entirely?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Isaac Fink
  • 85
  • 8
  • I edited to clarify my question. Also, that post was closed as "unclear what you're asking" without a solution. – Isaac Fink Sep 16 '19 at 01:30
  • There are [plenty](https://stackoverflow.com/q/23904274/354577) of [other](https://stackoverflow.com/q/11509830/354577) duplicate [questions](https://stackoverflow.com/q/46211657/354577) with the same answer. Just because the person who asked that question didn't accept an answer doesn't mean the answer wasn't provided. – ChrisGPT was on strike Sep 16 '19 at 01:46

0 Answers0