dotnet / docfx

Static site generator for .NET API documentation.
https://dotnet.github.io/docfx/
MIT License
4.06k stars 863 forks source link

Nested region tags are stripped from imported C# code using `code-csharp` #1899

Open arlosi opened 7 years ago

arlosi commented 7 years ago

DocFX Version Used: 2.21.1

Steps to Reproduce:

  1. Create C# file with nested regions such as:

    #region OUTER
    public class Foo{
    #region INNER
    // hello
    #endregion
    }
    #endregion
  2. Import the cshrap into markdown using the DFM syntax, selecting the outer region. [!code-csharp[Main](testfile.cs#OUTER)]

Expected Behavior: Contents of the OUTER region are displayed.

public class Foo{
    #region INNER
    // hello
    #endregion
}

Actual Behavior: The INNER region tags (both start and end) are dropped.

public class Foo{
    //hello
}

Including the whole file, or including the range with line numbers works as expected (regions are not dropped).

vwxyzh commented 7 years ago

following lines should remove:

// <name>
// </name>

following lines should not remove:

#region name
#engregion