File tree Expand file tree Collapse file tree 4 files changed +115
-1
lines changed
changelog_unreleased/markdown
tests/format/misc/embedded_language_formatting/in-markdown Expand file tree Collapse file tree 4 files changed +115
-1
lines changed Original file line number Diff line number Diff line change
1
+ #### Preserve empty lines in front matter (#16347 by @fisker )
2
+
3
+ <!-- prettier-ignore -->
4
+ ``` markdown
5
+ <!-- Input -->
6
+ ---
7
+ foo:
8
+ - bar1
9
+
10
+ - bar2
11
+
12
+ - bar3
13
+ ---
14
+ Markdown
15
+
16
+ <!-- Prettier stable -->
17
+
18
+ ---
19
+ foo:
20
+ - bar1
21
+ - bar2
22
+ - bar3
23
+ ---
24
+
25
+ Markdown
26
+
27
+
28
+ <!-- Prettier main -->
29
+ ---
30
+ foo:
31
+ - bar1
32
+
33
+ - bar2
34
+
35
+ - bar3
36
+ ---
37
+
38
+ Markdown
39
+ ```
Original file line number Diff line number Diff line change @@ -212,7 +212,6 @@ function stripTrailingHardlineFromParts(parts) {
212
212
213
213
function stripTrailingHardlineFromDoc ( doc ) {
214
214
switch ( getDocType ( doc ) ) {
215
- case DOC_TYPE_ALIGN :
216
215
case DOC_TYPE_INDENT :
217
216
case DOC_TYPE_INDENT_IF_BREAK :
218
217
case DOC_TYPE_GROUP :
@@ -238,6 +237,7 @@ function stripTrailingHardlineFromDoc(doc) {
238
237
case DOC_TYPE_STRING :
239
238
return doc . replace ( / [ \n \r ] * $ / , "" ) ;
240
239
240
+ case DOC_TYPE_ALIGN :
241
241
case DOC_TYPE_CURSOR :
242
242
case DOC_TYPE_TRIM :
243
243
case DOC_TYPE_LINE_SUFFIX_BOUNDARY :
Original file line number Diff line number Diff line change @@ -106,6 +106,71 @@ Hello world!
106
106
================================================================================
107
107
` ;
108
108
109
+ exports [` issue-16342.md - { " embeddedLanguageFormatting" :" off" } format 1` ] = `
110
+ ====================================options=====================================
111
+ embeddedLanguageFormatting: "off"
112
+ parsers: ["markdown"]
113
+ printWidth: 80
114
+ | printWidth
115
+ =====================================input======================================
116
+ ---
117
+ foo:
118
+ - bar1
119
+
120
+ - bar2
121
+
122
+ - bar3
123
+ ---
124
+
125
+ Markdown
126
+
127
+ =====================================output=====================================
128
+ ---
129
+ foo:
130
+ - bar1
131
+
132
+ - bar2
133
+
134
+ - bar3
135
+ ---
136
+
137
+ Markdown
138
+
139
+ ================================================================================
140
+ ` ;
141
+
142
+ exports [` issue-16342.md format 1` ] = `
143
+ ====================================options=====================================
144
+ parsers: ["markdown"]
145
+ printWidth: 80
146
+ | printWidth
147
+ =====================================input======================================
148
+ ---
149
+ foo:
150
+ - bar1
151
+
152
+ - bar2
153
+
154
+ - bar3
155
+ ---
156
+
157
+ Markdown
158
+
159
+ =====================================output=====================================
160
+ ---
161
+ foo:
162
+ - bar1
163
+
164
+ - bar2
165
+
166
+ - bar3
167
+ ---
168
+
169
+ Markdown
170
+
171
+ ================================================================================
172
+ ` ;
173
+
109
174
exports [` test.md - { " embeddedLanguageFormatting" :" off" } format 1` ] = `
110
175
====================================options=====================================
111
176
embeddedLanguageFormatting: "off"
Original file line number Diff line number Diff line change
1
+ ---
2
+ foo :
3
+ - bar1
4
+
5
+ - bar2
6
+
7
+ - bar3
8
+ ---
9
+
10
+ Markdown
You can’t perform that action at this time.
0 commit comments