Closed filzrev closed 1 month ago
Attention: Patch coverage is 50.00000%
with 10 lines
in your changes are missing coverage. Please review.
Project coverage is 78.90%. Comparing base (
fe673ec
) to head (64af69e
). Report is 179 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
src/Docfx.Dotnet/DotnetApiCatalog.Toc.cs | 40.00% | 8 Missing and 1 partial :warning: |
src/docfx/Models/MetadataCommand.cs | 0.00% | 0 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This PR intended to fix #9934 feature request issue by adding new
categoryLayout
option.Description This PR add following options to docfx metadata config.
categoryLayout
Specifies how categories in TOC are organized:
flattened
(default): Renders the namespaces as a plain label.nested
: Renders the categories in a nested tree form.none
: Don't render category labels. (It's added to support similar layout asmref
output format)Unit Tests It's manually tested by using
docfx\samples\seed
docs with bothsamePage
/separatedPages
options. And it pass following unit tests. (It require slow code analysis operation. So it's excluded from this commit)MetadataCommandApiPageTocCategoryTest.cs
/// Use MetadataCommand to generate YAML files from a c# project and a VB project separately ///
private readonly string _outputFolder; private readonly string _projectFolder; public MetadataCommandApiPageTocCategoryTest() { _outputFolder = GetRandomFolder(); _projectFolder = GetRandomFolder(); } [Fact] [Trait("Related", "docfx")] public async Task TestSeparatedPagesTocWithDefaulCategories() { var projectFile = Path.Combine(_projectFolder, "test.csproj"); var sourceFile = Path.Combine(_projectFolder, "test.cs"); File.Copy("Assets/test.csproj.sample.1", projectFile); File.Copy("Assets/test-multinamespace.cs.sample.1", sourceFile); await DotnetApiCatalog.Exec( new(new MetadataJsonItemConfig { Dest = _outputFolder, Src = new(new FileMappingItem(projectFile)) { Expanded = true }, NamespaceLayout = NamespaceLayout.Nested, CategoryLayout = CategoryLayout.Flattened, MemberLayout = MemberLayout.SeparatePages, OutputFormat = MetadataOutputFormat.ApiPage, }), new(), Directory.GetCurrentDirectory()); var file = Path.Combine(_outputFolder, "toc.yml"); Assert.True(File.Exists(file)); var tocViewModel = YamlUtility.Deserialize