Skip to content

Commit 1bdcb8d

Browse files
authored
fix: enabled headings in message markdown (#2829)
1 parent 80fe505 commit 1bdcb8d

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/components/Message/renderText/__tests__/__snapshots__/renderText.test.js.snap

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,11 @@ exports[`keepLineBreaksPlugin absent does not keep line breaks between the items
209209
</div>
210210
`;
211211

212-
exports[`keepLineBreaksPlugin absent does not keep line breaks under a heading 1`] = `
212+
exports[`keepLineBreaksPlugin absent keeps line breaks natively under a heading 1`] = `
213213
<div>
214-
Heading
214+
<h2>
215+
Heading
216+
</h2>
215217
216218
217219
<p>
@@ -669,7 +671,9 @@ exports[`keepLineBreaksPlugin present keeps line breaks between the items in an
669671

670672
exports[`keepLineBreaksPlugin present keeps line breaks under a heading 1`] = `
671673
<div>
672-
Heading
674+
<h2>
675+
Heading
676+
</h2>
673677
674678
675679
<br />

src/components/Message/renderText/__tests__/renderText.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ describe('keepLineBreaksPlugin', () => {
337337
const container = doRenderText(orderedListText, present);
338338
expect(container).toMatchSnapshot();
339339
});
340-
it(`does not keep line breaks under a heading`, () => {
340+
it(`keeps line breaks natively under a heading`, () => {
341341
const container = doRenderText(headingText, present);
342342
expect(container).toMatchSnapshot();
343343
});

src/components/Message/renderText/renderText.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ export const defaultAllowedTagNames: Array<
4545
// custom types (tagNames)
4646
'emoji',
4747
'mention',
48+
'h1',
49+
'h2',
50+
'h3',
51+
'h4',
52+
'h5',
53+
'h6',
4854
];
4955

5056
function formatUrlForDisplay(url: string) {

0 commit comments

Comments
 (0)