0

Does anyone know of a way to stop EE from injecting spans (with inline styles) into code blocks in comments? I'm fine with the div wrapping the code (that's not that big of a deal), but the spans are completely unnecessary.

Example output from EE:

<div class="codeblock">
    <code>
        <span style="color: #000000">
            <span style="color: #0000BB">This is code</span>
        </span>
    </code>
</div>

Edit to update: I've worked around this problem by using the following CSS to override the inline styles, so really this is just a matter of "I don't want junk in my markup" over broken functionality. (Also, a matter of pride, because !important is !embarassing.)

.codeblock code, .codeblock span {
    color: #ddd !important;
}
4
  • What editor are you using? Wygwam? EE Rich text? – Johnathan Waters Aug 14 '14 at 18:04
  • It's a jQuery plugin that gives a WYSIWYG editor for BBCode (since we're talking comments, here). I can confirm that the editor isn't the issue, as the comment stored in the database is strictly [code]This is code[/code]. Thanks for asking, though, as I was coming back here to add this bit of detail. :) – Vince Falconi Aug 14 '14 at 18:17
  • I'm pretty sure that EE doesn't do this. If it's in a code block then could it be some kind of syntax highlighting add-on or even a browser plugin? Do you have a URL we can see? – foamcow Aug 15 '14 at 8:18
  • Nope, I can confirm that it is in the source code, not a DOM injection (browser plugin). Tested in multiple browsers on my machine, still happened. Also tested it in a BrowserStack instance (IE6, just for kicks) and it still occurred. We have no highlighting add-ons installed. I even removed the one plugin that was wrapping the {comment} (the EE no_follow plugin), and it still happened. Project isn't production-ready, so no shareable URL unfortunately. I'm confident this is a legit bug, so I'm going to file a ticket. I'll follow up here with anything that happens from it. – Vince Falconi Aug 15 '14 at 16:03
0

Per this EE bug report: "...code tags are being parsed...[a]nd we add our own styling when that’s done."

So this is expected behavior, but overrideable with CSS:

.codeblock code, .codeblock span {
    color: [YOUR COLOR HERE] !important;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.