This project has moved. For the latest updates, please go here.

How to exclude specific regions in a code block?

Topics: User Forum
Jan 5, 2015 at 12:49 PM
Hi All,

I would like to exclude specific regions in a code block.

For example,
<code source="SourceFile.cs" region="Include region" excludeRegion="Exclude 1,Exclude 2" lang="cs" outlining="true" title="Xxx"/>

Since no such attribute is defined for <code/> element, am I able to add a custom attribute to <code/> and handle it with a custom handler, perhaps, defined as an XSL transformation?

Many thanks!
Jan 5, 2015 at 3:10 PM
Edited Jan 5, 2015 at 3:10 PM
Excluding sections of imported code is not supported. You'd have to make changes to the Code Block Component in order to support it. Depending on what you are trying to accomplish, you can probably achieve the same result by using nested code blocks that import the regions you are trying to combine:
<!-- Attributes to define behavior go on the parent element.
     Nested elements only specify the source and region attributes -->
<code language="cs" title="Nested Code Blocks" outlining="true">
    <code source="Source.cs" region="Combine Region 1"  />
    <code source="Source.cs" region="Combine Region 2" />
You can also mix literal text or code in between the imported regions if needed.