Preview code with

Jun 12, 2012 at 9:49 AM


in the latest version the preview code does not build the whole content and it displays the topic right away. However, there is a limitation for code snippets - they are not displayed. 

Is it possible to review them without having to build the whole project? If not, it will be great addition if it is possible to use the old previewer for example with Ctrl+F5, which we can use for a final review of the article and keep the F5 with the quick preview, for constant previews.

Jun 12, 2012 at 8:46 PM

Are you referring to <code> elements with a source attribute to import code or <codeReference> elements used for code from a snippets file?  If the former, I may implement that at some point as it shouldn't be too hard to do.  If its the latter, it's more difficult as <codeReference> elements are processed by a build component and I'm not keen to reimplement what it does just for previewing.



Jun 13, 2012 at 6:02 AM

Thank you for your reply.

Here is what I am using:

 <code source="..\CodeSamples\\MyCodeFile.cs" region="SomeRegion" lang="cs" title="[C#]" />

And here is the result:

Jun 27, 2012 at 12:31 PM

Should it be working with this?

Jun 27, 2012 at 4:03 PM

No, it currently won't import code from external files.  It just notes the file reference.  I may support this in a later release.



Jun 27, 2012 at 6:45 PM

I see.

It will really be a nice feature since one will be able to see the code referenced right away. Often mistake is to have wrong code in the region or wrong region referenced.

Should I add this somewhere or you will have it in mind?

Jun 27, 2012 at 8:28 PM

You can open a work item for it over in the SHFB project if you like.



Jun 28, 2012 at 7:47 PM

Here it is if someone looks for it:


Thanks Eric