Skip to content

Description should be empty when it is missing in ModuleFile #769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2025
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
3 changes: 2 additions & 1 deletion src/MarkdownReader/ModuleFileMarkdownReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ internal static string GetModuleFileDescriptionFromMarkdown(ParsedMarkdownConten
var nextHeader = md.FindHeader(nextHeaderLevel, "");
if (nextHeader == -1)
{
nextHeaderLevel = 3;
md.CurrentIndex--; // Back up to the description header
return string.Empty;
}

string descriptionString = MarkdownConverter.GetLinesTillNextHeader(md, nextHeaderLevel, index);
Expand Down
8 changes: 7 additions & 1 deletion test/Pester/ImportMarkdownModuleFile.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Describe "Import-ModuleFile tests" {
Context "File creation" {
It "Should be able to read module files" {
$results = $modFiles.FullName | Import-MarkdownModuleFile
$results.Count | Should -Be 14
$results.Count | Should -Be 15
}

It "Should produce the correct type of object" {
Expand Down Expand Up @@ -87,6 +87,12 @@ Describe "Import-ModuleFile tests" {
$mf0.CommandGroups[0].Commands[$offset].Description | Should -Be $Description

}

It "Should be able to parse even if description is missing" {
$mf = Import-MarkdownModuleFile "${PSScriptRoot}/assets/Microsoft.SystemCenter.ServiceManagementAutomation.md"
$mf.Description | Should -Be ""
$mf.CommandGroups.Count | Should -Be 1
}
}

Context "Metadata content" {
Expand Down
4 changes: 2 additions & 2 deletions test/Pester/MeasurePlatyPSMarkdown.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Describe "Export-MarkdownModuleFile" {
It "Should identify all the '<fileType>' assets" -TestCases @(
@{ fileType = "unknown"; expectedCount = 2 }
@{ fileType = "CommandHelp"; expectedCount = 41 }
@{ fileType = "ModuleFile"; expectedCount = 15 }
@{ fileType = "V1Schema"; expectedCount = 51 }
@{ fileType = "ModuleFile"; expectedCount = 16 }
@{ fileType = "V1Schema"; expectedCount = 52 }
@{ fileType = "V2Schema"; expectedCount = 5 }
) {
param ($fileType, $expectedCount)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
Download Help Link:
Help Version: 5.0.0.0
Locale: en-US
Module Guid: 03F356FB-485D-41BC-B7FE-7F573ECC186F
Module Name: Microsoft.SystemCenter.ServiceManagementAutomation
---

# Microsoft.SystemCenter.ServiceManagementAutomation Module
## Description

## Microsoft.SystemCenter.ServiceManagementAutomation Cmdlets
### [Edit-SmaRunbook](Edit-SmaRunbook.md)
Updates the draft field of a runbook.

### [Get-SmaAdminConfiguration](Get-SmaAdminConfiguration.md)
Gets the SMA administration configuration.

### [Get-SmaCertificate](Get-SmaCertificate.md)
Gets a certificate.

### [Get-SmaConnection](Get-SmaConnection.md)
Gets an SMA connection.

### [Get-SmaConnectionField](Get-SmaConnectionField.md)
Gets an SMA connection field.

### [Get-SmaConnectionType](Get-SmaConnectionType.md)
Gets all SMA connection types.

### [Get-SmaCredential](Get-SmaCredential.md)
Gets SMA credentials.

### [Get-SmaJob](Get-SmaJob.md)
Gets a runbook job.

### [Get-SmaJobOutput](Get-SmaJobOutput.md)
Gets the output of a SMA job.

### [Get-SmaLicense](Get-SmaLicense.md)
Gets an SMA license.

### [Get-SmaModule](Get-SmaModule.md)
Gets a module from SMA.

### [Get-SmaRunbook](Get-SmaRunbook.md)
Gets an SMA runbook.

### [Get-SmaRunbookDefinition](Get-SmaRunbookDefinition.md)
Gets a runbook definition.

### [Get-SmaRunbookWorkerDeployment](Get-SmaRunbookWorkerDeployment.md)
Gets all runbook workers in the SMA deployment.

### [Get-SmaSchedule](Get-SmaSchedule.md)
Gets an SMA schedule.

### [Get-SmaVariable](Get-SmaVariable.md)
Gets an SMA variable.

### [Import-SmaModule](Import-SmaModule.md)
Imports a module into SMA.

### [Import-SmaRunbook](Import-SmaRunbook.md)
Imports a runbook into SMA.

### [New-SmaConnection](New-SmaConnection.md)
Creates a connection instance in SMA.

### [New-SmaRunbookWorkerDeployment](New-SmaRunbookWorkerDeployment.md)
Changes the runbook worker deployment in SMA.

### [Publish-SmaRunbook](Publish-SmaRunbook.md)
Publishes a runbook in SMA.

### [Remove-SmaCertificate](Remove-SmaCertificate.md)
Deletes a certificate from SMA.

### [Remove-SmaConnection](Remove-SmaConnection.md)
Deletes a connection from SMA.

### [Remove-SmaCredential](Remove-SmaCredential.md)
Deletes a credential from SMA.

### [Remove-SmaModule](Remove-SmaModule.md)
Deletes a module from SMA.

### [Remove-SmaRunbook](Remove-SmaRunbook.md)
Removes a runbook from SMA.

### [Remove-SmaSchedule](Remove-SmaSchedule.md)
Deletes a schedule from SMA.

### [Remove-SmaVariable](Remove-SmaVariable.md)
Deletes a variable from SMA.

### [Resume-SmaJob](Resume-SmaJob.md)
Resumes a SMA job.

### [Set-SmaAdminConfiguration](Set-SmaAdminConfiguration.md)
Modifies administrative configuration settings in SMA.

### [Set-SmaCertificate](Set-SmaCertificate.md)
Creates or updates a certificate in SMA.

### [Set-SmaConnectionFieldValue](Set-SmaConnectionFieldValue.md)
Modifies a connection field value for a connection object in SMA.

### [Set-SmaCredential](Set-SmaCredential.md)
Creates or updates a credential in SMA.

### [Set-SmaLicense](Set-SmaLicense.md)
Updates the SMA product key.

### [Set-SmaRunbookConfiguration](Set-SmaRunbookConfiguration.md)
Modifies the configuration of a runbook.

### [Set-SmaSchedule](Set-SmaSchedule.md)
Creates or modifies a schedule in SMA.

### [Set-SmaVariable](Set-SmaVariable.md)
Creates or modifies a variable in SMA.

### [Start-SmaRunbook](Start-SmaRunbook.md)
Starts a runbook job.

### [Stop-SmaJob](Stop-SmaJob.md)
Stops a SMA job.

### [Suspend-SmaJob](Suspend-SmaJob.md)
Suspends an SMA job.