Add support for colors (and other styles) inside <pre> tags
PHP class for PDF
Brought to you by:
nicolaasuni
Hi!
I'd like to put highlighted code into a PDF. As most IDE's or code-highlighters can export to HTML, the writeHTML() method seemed ideal for that task.
However all code inside <pre>
tags ignores formatting and color, which are extremely helpful for code readability.
One could strip the <pre>
tags and use nl2br(), but this way the code indentation is not preserved.
I get that bold or italic code segments would need another monospaced font-variant, but at least colors inside <pre>
would be insanely helpful.