Html formatting across multiple output formats

I am writing technical documents and need to put in style code snippets something like this…

Screen Shot 2011-08-08 at 12.52.23.png

(yes, the colors are important and meaningful to the reader) I paste this in markdown using html like this…

<pre style="font-family: 'Courier New', Courier, monospace; font-size: 13; color: black; background: white;"><span style="color:blue;">var</span>&nbsp;amazonSqs&nbsp;=&nbsp;<span style="color:#2b91af;">AWSClientFactory</span>.CreateAmazonSQSClient(<span style="color:#a31515;">&quot;AccessKey&quot;</span>,&nbsp;<span style="color:#a31515;">&quot;SecretKey&quot;</span>); </Pre>

If I paste in the compile to markdown->html then everything looks great (because html is left alone) but compiling for pdf displays it as text, with all the tags.

If I want to output to pdf, I have to paste it as rich text and preserve formatting, but then it gets lost when I compile the same to markdown->html.

Also, when compiling to kindle, the text is not monospaced. If you send in a file with

 tags into kindlegen it subsitutes a monospace tag. Which is what I need, but Scrivener drops the tags, meaning that the output is in a normal font. So I can take the markdown->html output and manually push it through kindlegen, but then have a lot of other work to do (contents etc).

I am looking for ideas to output to markdown->html, kindle and pdf from the same source, just setting compile options (without separately labeled source text for each output format). My preference is a markdown source, I’m not keen on having scrivener take care of storing the formatting.

Simon