This project has moved and is read-only. For the latest updates, please go here.

Correct way to turn off syntax highlighting :: v1.8.0.3

Topics: User Forum
Jul 8, 2010 at 1:27 AM


Does anyone know the correct (and easiest) way to turn off syntax highlighting for code samples?  We recently published the Messenger Connect content onto MSDN using HxS files produced by SFHB v1.8.0.3. We ran into a compatibility issue with the "Copy Code" button that seems to be caused by the extra styling in the code sample blocks. Notice that the copy code button does not work for the code sample in this page:

We published this page using the same version of Sandcastle, but without using SHFB.  The "Copy" button works fine for the samples:

Thanks in advance for your help.

Best Regards,

Dominic Ferraro

Windows Live Build Engineer - MSFT

Jul 8, 2010 at 2:55 AM

The code block component is a standard part of the configuration files used by SHFB and there isn't currently a way to turn it off completely.  It's only designed to work with the presentation styles supplied with Sandcastle that we have access to so I can't guarantee any compatibilty with presentation styles used on MSDN content.  What you can do is manually edit the configuration files in the .\Templates folder under the SHFB installation folder and remove it.  I'm assuming you are using the VS2005 presentation style so you'd open .\Templates\VS2005.config, find the component element for CodeBlockComponent and delete it or comment it out.  Everthing else should work fine.  Since there won't be any colorized code blocks, the PostTransformComponent will skip the stuff related to the additional scripts and stylesheets.  I can add an option to the next release to disable the component so that it does nothing so that you don't have to manually remove it from the configuration file.



Jul 8, 2010 at 3:27 AM
Edited Jul 8, 2010 at 3:40 AM

Thanks Eric, that did exactly what we wanted. The code sample blocks are no longer colorized, so I think this may do the trick. We’ll have to test the content on our staging server to verify that it fixes the problem.