Skip to content

Commit

Permalink
Merge pull request #9 from razroo/ZETA-7550-add-br-tag
Browse files Browse the repository at this point in the history
ZETA-7550: add br logic
  • Loading branch information
CharlieGreenman authored Jan 1, 2024
2 parents 8096ae4 + 9d56a74 commit 92bc57f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ it('should convert a paragraph code block thereafter', () => {
});

it('should convert a pre tag to code block', () => {
const htmlString = `<p>test <b>this</b></p>
const htmlString = `<p>test <b>this</b><br></p>
<pre> // hello </pre>
`;
const result = convertHtmlToADF(htmlString);
Expand All @@ -101,7 +101,12 @@ it('should convert a pre tag to code block', () => {
"type": "strong"
}
]
}
},
{
"type": "hardBreak",
"text": "",
marks: []
}
]
},
{
Expand Down
3 changes: 1 addition & 2 deletions src/html-to-adf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const processNode = (node: any, marks = [] as any) => {
},
});
} else if (node.name === "br") {
textNodes.push({ type: "text", text: " ", marks: [] });
textNodes.push({ type: "hardBreak", text: "", marks: [] });
}
}

Expand Down Expand Up @@ -71,7 +71,6 @@ export function convertHtmlToADF(htmlString: string): any {
content: [{ type: "text", text: textNodes, marks: [] }],
});
} else if(node.name === "code" || node.name === 'pre') {
console.log('inside here called');
adf.content.push({
type: "codeBlock",
attrs: {},
Expand Down

0 comments on commit 92bc57f

Please sign in to comment.