Thursday, 19 June 2014

PRE tags in HTML copy confuses other HTML editors

I use Microsoft's Productivity Power Tools in Visual Studio and one of the features it gives me is the ability to copy my code out as HTML - so I can paste it to sites such as this.

This is usually great, but the default PRE tag that surrounds each code snippet can confuse other sites where the PRE tag is interpreted as 'any text before the next </pre> is literal'.

Fortunately the HTML Copy options allow me to specify the markup before/after each code snippet.


With the default 'BeforeCodeSnippet' being:

  <pre style="{font-family}{font-size}{font-weight}{font-style}{color}{background}">

I can now change this from PRE to SPAN and all seems well with the world.


No comments: