Skip to content

Commit 705f174

Browse files
lipkauTylerLeonhardt
authored andcommitted
Fix markdown syntax (#1382)
* Added rule for markdown linter this makes markdown linter ignore duplicate headers in the same document * Fixed styling of community snippets * have all indentation to look alike * have code of snippets to use `\t` * Fixed typo in snippet name * Fixed tab char in snippets * Replaced 2nd tab-stop with final tab-stop
1 parent 7f626d9 commit 705f174

File tree

3 files changed

+111
-106
lines changed

3 files changed

+111
-106
lines changed

.vscode/settings.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@
1414
},
1515

1616
// Lock the TypeScript SDK path to the version we use
17-
"typescript.tsdk": "./node_modules/typescript/lib"
17+
"typescript.tsdk": "./node_modules/typescript/lib",
18+
19+
// Ignore the MD rule:
20+
"markdownlint.config": {
21+
"MD024": false // no-duplicate-header
22+
}
1823
}

docs/community_snippets.md

+102-102
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ Creates Assert Mock for Pester Tests y @SQLDBAWithABeard
3939
#### Snippet
4040

4141
```json
42-
"AssertMock": {
43-
"prefix": "AssertMock",
44-
"body": [
45-
"$$assertMockParams = @{",
46-
"'CommandName' = '${1:Command}'",
47-
"'Times' = ${2:1}",
48-
"'Exactly' = $$true",
49-
"}",
50-
"Assert-MockCalled @assertMockParams"
51-
],
52-
"description": "AssertMock snippet for Pestering"
53-
}
42+
"AssertMock": {
43+
"prefix": "AssertMock",
44+
"body": [
45+
"$$assertMockParams = @{",
46+
"\t'CommandName' = '${1:Command}'",
47+
"\t'Times' = ${2:1}",
48+
"\t'Exactly' = $$true",
49+
"}",
50+
"Assert-MockCalled @assertMockParams"
51+
],
52+
"description": "AssertMock snippet for Pestering"
53+
}
5454
```
5555

5656
### AWSRegionDynamicParameter
@@ -61,28 +61,28 @@ Creates a dynamic parameter of the current AWS regions. Includes parameter vali
6161

6262
```json
6363
"AWSRegionDynamicParam": {
64-
"prefix": "aws_region",
65-
"body": [
66-
"DynamicParam {",
67-
"\t$ParamDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary",
68-
"\t$CR_ParamName = 'Region'",
69-
"\t$CR_AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]",
70-
"\t$CR_Attribute = New-Object System.Management.Automation.ParameterAttribute",
71-
"\t$CR_Attribute.HelpMessage = 'List all the regions to be included in the document'",
72-
"\t$CR_Attribute.Mandatory = $true",
73-
"\t$CR_Attribute.ValueFromPipelineByPropertyName = $true",
74-
"\t$CR_AttributeCollection.add($CR_Attribute)",
75-
"\t$CR_intRegions = Get-AWSRegion -IncludeChina | Select-Object -ExpandProperty Region",
76-
"\t$CR_intRegions += Get-AWSRegion -IncludeGovCloud | Select-Object -ExpandProperty Region",
77-
"\t$CR_intRegions = $CR_intRegions | Select-Object -Unique",
78-
"\t$CR_ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($CR_intRegions)",
79-
"\t$CR_AttributeCollection.add($CR_ValidateSetAttribute)",
80-
"\t$CR_Param = New-Object System.Management.Automation.RuntimeDefinedParameter($CR_ParamName, [String[]],$CR_AttributeCollection)",
81-
"\t$ParamDictionary.Add($CR_ParamName, $CR_Param)",
82-
"\treturn $paramDictionary",
83-
"\t}"
84-
],
85-
"description": "A dynamic parameter that builds a list of AWS regions"
64+
"prefix": "aws_region",
65+
"body": [
66+
"DynamicParam {",
67+
"\t$ParamDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary",
68+
"\t$CR_ParamName = 'Region'",
69+
"\t$CR_AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]",
70+
"\t$CR_Attribute = New-Object System.Management.Automation.ParameterAttribute",
71+
"\t$CR_Attribute.HelpMessage = 'List all the regions to be included in the document'",
72+
"\t$CR_Attribute.Mandatory = $true",
73+
"\t$CR_Attribute.ValueFromPipelineByPropertyName = $true",
74+
"\t$CR_AttributeCollection.add($CR_Attribute)",
75+
"\t$CR_intRegions = Get-AWSRegion -IncludeChina | Select-Object -ExpandProperty Region",
76+
"\t$CR_intRegions += Get-AWSRegion -IncludeGovCloud | Select-Object -ExpandProperty Region",
77+
"\t$CR_intRegions = $CR_intRegions | Select-Object -Unique",
78+
"\t$CR_ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($CR_intRegions)",
79+
"\t$CR_AttributeCollection.add($CR_ValidateSetAttribute)",
80+
"\t$CR_Param = New-Object System.Management.Automation.RuntimeDefinedParameter($CR_ParamName, [String[]],$CR_AttributeCollection)",
81+
"\t$ParamDictionary.Add($CR_ParamName, $CR_Param)",
82+
"\treturn $paramDictionary",
83+
"\t}"
84+
],
85+
"description": "A dynamic parameter that builds a list of AWS regions"
8686
}
8787
```
8888

@@ -94,11 +94,11 @@ Create calculated property for use in Select Statements
9494

9595
```json
9696
"Add Calculated Property": {
97-
"prefix": "cf",
98-
"body": [
99-
"@{'Name' = '$1' ; 'Expression' = {$2}}",
100-
],
101-
"description": "Create calculated property for use in Select Statements"
97+
"prefix": "cf",
98+
"body": [
99+
"@{'Name' = '$1' ; 'Expression' = {$2}}",
100+
],
101+
"description": "Create calculated property for use in Select Statements"
102102
}
103103
```
104104

@@ -110,31 +110,31 @@ Quickly create a Data Table object by @SQLDBAWithABeard.
110110

111111
```json
112112
"DataTable": {
113-
"prefix": "DataTable",
114-
"body": [
115-
"# Create DataTable Object",
116-
"$$table = New-Object system.Data.DataTable $$TableName",
113+
"prefix": "DataTable",
114+
"body": [
115+
"# Create DataTable Object",
116+
"$$table = New-Object system.Data.DataTable $$TableName",
117117

118-
"\r# Create Columns",
119-
"$$col1 = New-Object system.Data.DataColumn NAME1,([string])",
120-
"$$col2 = New-Object system.Data.DataColumn NAME2,([decimal])",
118+
"\r# Create Columns",
119+
"$$col1 = New-Object system.Data.DataColumn NAME1,([string])",
120+
"$$col2 = New-Object system.Data.DataColumn NAME2,([decimal])",
121121

122-
"\r#Add the Columns to the table",
123-
"$$table.columns.add($$col1)",
124-
"$$table.columns.add($$col2)",
122+
"\r#Add the Columns to the table",
123+
"$$table.columns.add($$col1)",
124+
"$$table.columns.add($$col2)",
125125

126-
"\r# Create a new Row",
127-
"$$row = $$table.NewRow() ",
126+
"\r# Create a new Row",
127+
"$$row = $$table.NewRow() ",
128128

129-
"\r# Add values to new row",
130-
"$$row.Name1 = 'VALUE'",
131-
"$$row.NAME2 = 'VALUE'",
129+
"\r# Add values to new row",
130+
"$$row.Name1 = 'VALUE'",
131+
"$$row.NAME2 = 'VALUE'",
132132

133-
"\r#Add new row to table",
134-
"$$table.Rows.Add($$row)"
135-
],
136-
"description": "Creates a Data Table Object"
137-
}
133+
"\r#Add new row to table",
134+
"$$table.Rows.Add($$row)"
135+
],
136+
"description": "Creates a Data Table Object"
137+
}
138138
```
139139

140140
### DateTimeWriteVerbose
@@ -181,14 +181,14 @@ Add If Should Process with easy tab inputs
181181

182182
```json
183183
"IfShouldProcess": {
184-
"prefix": "IfShouldProcess",
185-
"body": [
186-
"if ($$PSCmdlet.ShouldProcess(\"${1:The Item}\" , \"${2:The Change}\")) {",
187-
" # Place Code here",
188-
"}"
189-
],
190-
"description": "Creates an if should process"
191-
}
184+
"prefix": "IfShouldProcess",
185+
"body": [
186+
"if ($$PSCmdlet.ShouldProcess(\"${1:The Item}\" , \"${2:The Change}\")) {",
187+
"\t# Place Code here",
188+
"}"
189+
],
190+
"description": "Creates an if should process"
191+
}
192192
```
193193

194194
### MaxColumnLengthinDataTable
@@ -198,22 +198,22 @@ Takes a datatable object and iterates through it to get the max length of the st
198198
#### Snippet
199199

200200
```json
201-
"Max Length of Datatable": {
202-
"prefix": "Max Length of Datatable",
203-
"body": [
204-
"$$columns = ($$datatable | Get-Member -MemberType Property).Name",
205-
"foreach($$column in $$Columns) {",
206-
" $$max = 0",
207-
" foreach ($$a in $$datatable){",
208-
" if($$max -lt $$a.$$column.length){",
209-
" $$max = $$a.$$column.length",
210-
" }",
211-
" }",
212-
" Write-Output \"$$column max length is $$max\"",
213-
"}"
214-
],
215-
"description": "Takes a datatable object and iterates through it to get the max length of the string columns - useful for data loads"
216-
}
201+
"Max Length of Datatable": {
202+
"prefix": "Max Length of Datatable",
203+
"body": [
204+
"$$columns = ($$datatable | Get-Member -MemberType Property).Name",
205+
"foreach($$column in $$Columns) {",
206+
"\t$$max = 0",
207+
"\tforeach ($$a in $$datatable){",
208+
"\t\tif($$max -lt $$a.$$column.length){",
209+
"\t\t\t$$max = $$a.$$column.length",
210+
"\t\t}",
211+
"\t}",
212+
"\tWrite-Output \"$$column max length is $$max\"",
213+
"}"
214+
],
215+
"description": "Takes a datatable object and iterates through it to get the max length of the string columns - useful for data loads"
216+
}
217217
```
218218

219219
### Parameter-Credential
@@ -244,15 +244,15 @@ Quickly create a Pester Test for existence of a mandatory parameter by @SQLDBAWi
244244
#### Snippet
245245

246246
```json
247-
"Pester for Mandatory Pester": {
248-
"prefix": "mandatoryParamPester",
249-
"body": [
250-
"It \"${1:FunctionName} Should have a mandatory parameter ${2:ParameterName}\" {",
251-
" (Get-Command ${1:FunctionName}).Parameters['${2:ParameterName}'].Attributes.Mandatory | Should -BeTrue",
252-
"}"
253-
],
254-
"description": "Pester Test for Parameter"
255-
}
247+
"Pester for Mandatory Parameter": {
248+
"prefix": "mandatoryParamPester",
249+
"body": [
250+
"It \"${1:FunctionName} Should have a mandatory parameter ${2:ParameterName}\" {",
251+
"\t(Get-Command ${1:FunctionName}).Parameters['${2:ParameterName}'].Attributes.Mandatory | Should -BeTrue",
252+
"}"
253+
],
254+
"description": "Pester Test for Parameter"
255+
}
256256
```
257257

258258
### PesterTestForParameter
@@ -262,15 +262,15 @@ Quickly create a Pester Test for existence of a parameter by @SQLDBAWithABeard
262262
#### Snippet
263263

264264
```json
265-
"Pester for Parameter": {
266-
"prefix": "Param Pester",
267-
"body": [
268-
"It \"${1:FunctionName} Should have a parameter ${2:ParameterName}\" {",
269-
" (Get-Command ${1:FunctionName}).Parameters['${2:ParameterName}'].Count | Should -Be 1",
270-
"}"
271-
],
272-
"description": "Pester Test for Parameter"
273-
}
265+
"Pester for Parameter": {
266+
"prefix": "Param Pester",
267+
"body": [
268+
"It \"${1:FunctionName} Should have a parameter ${2:ParameterName}\" {",
269+
"\t(Get-Command ${1:FunctionName}).Parameters['${2:ParameterName}'].Count | Should -Be 1",
270+
"}"
271+
],
272+
"description": "Pester Test for Parameter"
273+
}
274274
```
275275

276276
### PSCustomObject
@@ -305,7 +305,7 @@ Use the `#region` for organizing your code (including good code folding).
305305
"prefix": "#region",
306306
"body": [
307307
"#region ${1}",
308-
"${2}",
308+
"$0",
309309
"#endregion"
310310
],
311311
"description": "Region Block for organizing and folding of your code"

snippets/PowerShell.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@
765765
"body": [
766766
"function ${1:FunctionName} {",
767767
"\tparam (",
768-
"\t ${2:OptionalParameters}",
768+
"\t\t${2:OptionalParameters}",
769769
"\t)",
770770
"\t$0",
771771
"}"
@@ -863,7 +863,7 @@
863863
"workflow ${name:Verb-Noun} {",
864864
"\tparam (",
865865
"\t)",
866-
"\t",
866+
"",
867867
"\t$0",
868868
"}"
869869
],
@@ -948,7 +948,7 @@
948948
"prefix": "#region",
949949
"body": [
950950
"#region ${1}",
951-
"${2}",
951+
"$0",
952952
"#endregion"
953953
],
954954
"description": "Region Block for organizing and folding of your code"

0 commit comments

Comments
 (0)