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

newlines in <code> elements

Topics: Developer Forum, User Forum
Oct 9, 2012 at 12:15 PM
Edited Oct 9, 2012 at 12:42 PM


I've been trying to generate conceptual documents, but all linebreaks inside <code> elements are ignored. So

<code language="xml">




generates a single line of "<xml><test/></xml>" in the output. I really do want my long code samples to be shown on multiple lines, not all on one line.. using vs2010 style, generating html

Any ideas?

Oct 9, 2012 at 4:37 PM
Edited Oct 9, 2012 at 4:38 PM

Is this website output using the VS2010 style in Chrome or FireFox?  If so, it's caused by a style in the transformation which has been removed in the latest release (Sandcastle v2.7.1.0/SHFB  All other help formats and presentation styles should be fine.  The CDATA element should be unnecessary too.



Oct 16, 2012 at 8:47 AM

Thank you, works nicely now!

Is there a way to have the xml automatically indented (and not only colorized)? I can't put it outside CDATA as I also have <?xml.. and similar tags, which don't work too well otherwise..

Oct 16, 2012 at 4:02 PM
Edited Oct 16, 2012 at 4:02 PM

Formatting is not modified other than normalizing the leading whitespace so that the first line isn't indented with too much whitespace due to the formatting of the content in the XML comments file.  Other than that, all other formatting within the block is left as it is defined in the comments.  I missed the literal XML so as you say, the CDATA is needed in this case.  Another option would be to use the source attribute to import the XML from an external file.  As with inline code, the formatting would be preserved as imported from the file though.