File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,11 @@ function Validate-MarkdownHelp
118
118
if ($content [$idx + 1 ] -notcontains " ## SYNTAX" )
119
119
{
120
120
$idx ++
121
+ if ($idx -ge $content.Length )
122
+ {
123
+ Write-Error " Could not find SYNTAX header in file $ ( $file.Name ) "
124
+ return
125
+ }
121
126
}
122
127
elseif ($content [$idx ] -contains " {{Fill in the Synopsis}}" )
123
128
{
@@ -147,6 +152,11 @@ function Validate-MarkdownHelp
147
152
if ($content [$idx + 1 ] -notcontains " ## EXAMPLES" )
148
153
{
149
154
$idx ++
155
+ if ($idx -ge $content.Length )
156
+ {
157
+ Write-Error " Could not find EXAMPLES header in file $ ( $file.Name ) "
158
+ return
159
+ }
150
160
}
151
161
elseif ($content [$idx ] -contains " {{Fill in the Description}}" )
152
162
{
@@ -167,9 +177,14 @@ function Validate-MarkdownHelp
167
177
" ## EXAMPLES"
168
178
{
169
179
# Move the index to the start of the PowerShell code
170
- while ($content [$idx ] -notcontains " `````` " )
180
+ while ($content [$idx ] -notcontains " `````` " -and $content [ $idx ] -notcontains " `````` powershell " )
171
181
{
172
182
$idx ++
183
+ if ($idx -ge $content.Length )
184
+ {
185
+ Write-Error " Could not find start of PowerShell example in file $ ( $file.Name ) "
186
+ return
187
+ }
173
188
}
174
189
175
190
# Check for the platyPS example template
You can’t perform that action at this time.
0 commit comments