Skip to content

Commit c1b28f1

Browse files
Merge pull request #85 from contentstack/RT-488
fix: headings format returned in markdown was not as expected
2 parents 407773e + d2ddd73 commit c1b28f1

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/jsonToMarkdown.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@ const ELEMENT_TYPES: IJsonToMarkdownElementTags = {
1414
'h1': (attrs: any, child: string) => {
1515
return `
1616
17-
#${child}#`
17+
# ${child} #`
1818
},
1919
'h2': (attrs: any, child: any) => {
2020
return `
2121
22-
##${child}##`
22+
## ${child} ##`
2323
},
2424
'h3': (attrs: any, child: any) => {
2525
return `
2626
27-
###${child}###`
27+
### ${child} ###`
2828
},
2929
'h4': (attrs: any, child: any) => {
3030
return `
3131
32-
####${child}####`
32+
#### ${child} ####`
3333
},
3434
'h5': (attrs: any, child: any) => {
3535
return `
3636
37-
#####${child}#####`
37+
##### ${child} #####`
3838
},
3939
'h6': (attrs: any, child: any) => {
4040
return `
4141
42-
######${child}######`
42+
###### ${child} ######`
4343
},
4444
img: (attrsJson: any, child: any) => {
4545
if(attrsJson) {

test/expectedMarkdown.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,17 @@ This is a paragraph with \`inline code\`.`
163163
}],
164164
"markdown": `
165165
166-
#Heading 1#
166+
# Heading 1 #
167167
168-
##Heading 2##
168+
## Heading 2 ##
169169
170-
###Heading 3###
170+
### Heading 3 ###
171171
172-
####Heading 4####
172+
#### Heading 4 ####
173173
174-
#####Heading 5#####
174+
##### Heading 5 #####
175175
176-
######Heading 6######`
176+
###### Heading 6 ######`
177177
},
178178
{
179179
"title": "Block Quote Conversion",

0 commit comments

Comments
 (0)