Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,5 @@ FodyWeavers.xsd
/merge-solution.txt
/opencode-prompt.txt
/test-home
/reset-counter.ps1
/update-counter.ps1
15 changes: 10 additions & 5 deletions src/CloudNimble.DotNetDocs.Core/DocumentationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,20 @@ public async Task ProcessAsync(IEnumerable<(string assemblyPath, string xmlPath)
var assemblyList = assemblies.ToList();
var hasReferences = projectContext.DocumentationReferences.Any();

// Documentation-only mode: only process references, no assemblies
// Documentation-only mode: process references and/or template without local assemblies
if (assemblyList.Count == 0)
{
if (hasReferences)
// Run pipeline if we have references OR a MintlifyTemplate
if (hasReferences || projectContext.HasMintlifyTemplate)
{
// Process referenced documentation with format-specific handlers
await ProcessDocumentationReferencesAsync();
if (hasReferences)
{
// Process referenced documentation with format-specific handlers
await ProcessDocumentationReferencesAsync();
}

// Renderers still need to run for navigation file processing (pass null model)
// Renderers run for navigation file processing (pass null model)
// For Mintlify: generates docs.json from template + discovers content files
foreach (var renderer in renderers)
{
await renderer.RenderAsync(null);
Expand Down
9 changes: 9 additions & 0 deletions src/CloudNimble.DotNetDocs.Core/ProjectContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ public class ProjectContext
/// </value>
public bool ConceptualDocsEnabled { get; set; } = true;

/// <summary>
/// Gets or sets whether a MintlifyTemplate is defined.
/// </summary>
/// <value>
/// When true, docs.json will be generated even without assemblies to document.
/// The presence of a template is an explicit signal that the user wants documentation output.
/// </value>
public bool HasMintlifyTemplate { get; set; } = false;

/// <summary>
/// Gets or sets the collection of external documentation references to combine into this documentation collection.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<NamespaceMode>Folder</NamespaceMode>
<ShowDocumentationStats>true</ShowDocumentationStats>
<!-- Exclude test projects from documentation -->
<ExcludePatterns>Tests.Shared;*.Sdk</ExcludePatterns>
<ExcludePatterns>Tests.Shared;*.Sdk;test</ExcludePatterns>

<ConceptualDocsEnabled>true</ConceptualDocsEnabled>
<ShowPlaceholders>false</ShowPlaceholders>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,22 @@ public CloudNimble.DotNetDocs.Core.Configuration.FileNamingOptions FileNamingOpt
Type: `CloudNimble.DotNetDocs.Core.Configuration.FileNamingOptions`
Configuration for how documentation files are named and organized.

### <Icon icon="tag" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> HasMintlifyTemplate

Gets or sets whether a MintlifyTemplate is defined.

#### Syntax

```csharp
public bool HasMintlifyTemplate { get; set; }
```

#### Property Value

Type: `bool`
When true, docs.json will be generated even without assemblies to document.
The presence of a template is an explicit signal that the user wants documentation output.

### <Icon icon="tag" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> IncludedMembers

Gets or sets the list of member accessibilities to include in documentation.
Expand Down
32 changes: 24 additions & 8 deletions src/CloudNimble.DotNetDocs.Sdk.Tasks/GenerateDocumentationTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ public class GenerateDocumentationTask : Task
/// </summary>
public ITaskItem[]? ResolvedDocumentationReferences { get; set; }

/// <summary>
/// Gets or sets whether a MintlifyTemplate is defined (inline or file-based).
/// </summary>
/// <value>
/// When true, always generate docs.json regardless of assemblies.
/// The presence of a template is an explicit signal that the user wants documentation output.
/// </value>
public bool HasMintlifyTemplate { get; set; } = false;

#endregion

#region Public Methods
Expand Down Expand Up @@ -186,6 +195,7 @@ public override bool Execute()
context.FileNamingOptions.NamespaceMode = Enum.TryParse<NamespaceMode>(NamespaceMode, true, out var mode) ? mode : Core.Configuration.NamespaceMode.Folder;
context.ConceptualDocsEnabled = ConceptualDocsEnabled;
context.ShowPlaceholders = ShowPlaceholders;
context.HasMintlifyTemplate = HasMintlifyTemplate;

// Add the validated documentation references
foreach (var reference in documentationReferences)
Expand Down Expand Up @@ -333,15 +343,21 @@ public override bool Execute()
}

// Handle different scenarios based on what we have
if (assemblyPairs.Count == 0 && !hasReferences)
{
Log.LogMessage(MessageImportance.High, "No assemblies or documentation references found. Nothing to process.");
return true;
}

if (assemblyPairs.Count == 0 && hasReferences)
if (assemblyPairs.Count == 0)
{
Log.LogMessage(MessageImportance.High, "📚 Documentation-only mode: Processing DocumentationReferences without local assemblies");
if (hasReferences)
{
Log.LogMessage(MessageImportance.High, "📚 Documentation-only mode: Processing DocumentationReferences without local assemblies");
}
else if (HasMintlifyTemplate)
{
Log.LogMessage(MessageImportance.High, "📄 Template mode: Generating docs.json from MintlifyTemplate without assemblies");
}
else
{
Log.LogMessage(MessageImportance.High, "No assemblies, documentation references, or template found. Nothing to process.");
return true;
}
}

// Process all assemblies together to properly merge navigation
Expand Down
19 changes: 17 additions & 2 deletions src/CloudNimble.DotNetDocs.Sdk/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,32 @@
</CloudNimble.DotNetDocs.Sdk.Tasks.DiscoverDocumentedProjectsTask>

<Message Text="📚 Found @(DocumentedProjects->Count()) documented projects for documentation" Importance="high" />

<!-- Show the list of projects that will be documented -->
<ItemGroup>
<_ProjectNames Include="@(DocumentedProjects->'%(Filename)')" />
</ItemGroup>
<Message Text=" Projects: @(_ProjectNames, ', ')" Importance="normal" />
</Target>

<!-- Detect if MintlifyTemplate is present - if so, always run the pipeline -->
<Target Name="DetectMintlifyTemplateMode"
Condition="'$(GenerateDocumentation)' == 'true' AND '$(DocumentationType)' == 'Mintlify'"
AfterTargets="DiscoverDocumentedProjects">

<PropertyGroup>
<!-- If MintlifyTemplate (inline XML) or DocsJsonTemplatePath (external file) is defined -->
<HasMintlifyTemplate Condition="'$(MintlifyTemplate)' != '' OR '$(DocsJsonTemplatePath)' != ''">true</HasMintlifyTemplate>
<HasMintlifyTemplate Condition="'$(HasMintlifyTemplate)' == ''">false</HasMintlifyTemplate>
</PropertyGroup>

<Message Text="📄 MintlifyTemplate detected: $(HasMintlifyTemplate)" Importance="high" Condition="'$(HasMintlifyTemplate)' == 'true'" />
</Target>

<!-- Generate documentation from existing assemblies -->
<Target Name="GenerateDocumentation"
Condition="'$(GenerateDocumentation)' == 'true'"
DependsOnTargets="DiscoverDocumentedProjects">
DependsOnTargets="DiscoverDocumentedProjects;DetectMintlifyTemplateMode">
<Message Text="🚀 Generating documentation from existing assemblies..." Importance="high" />

<!-- Extract assembly paths from built projects (only main project assemblies) -->
Expand Down Expand Up @@ -134,6 +148,7 @@
SolutionName="$(_SolutionName)"
ConceptualDocsEnabled="$(ConceptualDocsEnabled)"
ShowPlaceholders="$(ShowPlaceholders)"
HasMintlifyTemplate="$(HasMintlifyTemplate)"
ResolvedDocumentationReferences="@(ResolvedDocumentationReference)">
<Output TaskParameter="GeneratedFiles" ItemName="GeneratedDocumentationFiles" />
</CloudNimble.DotNetDocs.Sdk.Tasks.GenerateDocumentationTask>
Expand Down
6 changes: 0 additions & 6 deletions src/CloudNimble.DotNetDocs.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
<File Path="dotnet.config" />
<File Path="global.json" />
</Folder>
<Folder Name="/Solution Items/Build/">
<File Path="../.github/dependabot.yml" />
<File Path="../.github/workflows/build-and-deploy.yml" />
<File Path="../.github/workflows/pr-validation.yml" />
<File Path="../.github/workflows/README.md" />
</Folder>
<Folder Name="/Solution Items/Specs/">
<File Path="../specs/core-documentation-fixes.md" />
<File Path="../specs/core-documentation-spec.md" />
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<PackageId>$(MSBuildProjectName.Replace('CloudNimble.', ''))</PackageId>
<Product>DotNetDocs</Product>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<PackageVersion Condition="'$(PackageVersion)' == ''">1.2.0-preview.5</PackageVersion>
<PackageVersion Condition="'$(PackageVersion)' == ''">1.3.0-preview.1</PackageVersion>
<Authors>CloudNimble</Authors>
<Company>CloudNimble, Inc.</Company>
<RpmPackageVendor>CloudNimble</RpmPackageVendor>
Expand Down
Loading