JSFiddle - React, Tailwind, and code Playground
by David Thomas
HTML
<p>Perform the following commands:
<code>> cd /foo</code><code>> adb shell</code><code># ps</code>
</p>
<p>If you go to your <code>C:\</code> directory and run <code>dir</code> …</p>
CSS
code {
color: #000;
background-color: #ddd;
font-family: mono;
font-size: 0.8em;
}
.block {
display: block;
white-space: pre;
padding: 0.2em 0;
margin: 0 auto;
width: 80%;
}
.inline {
padding: 0 0.2em;
}
JavaScript
$('code').each(
function(){
if (this.previousSibling == this.previousElementSibling){
$(this).addClass('block');
}
else {
$(this).addClass('inline');
}
});