Skip to content

Commit

Permalink
Merge pull request #195 from HubSpot/bbriggs/code-block-default-output
Browse files Browse the repository at this point in the history
add default block HTML for code-block type
  • Loading branch information
Ben Briggs authored Aug 4, 2021
2 parents 5abc02f + 819b4a9 commit 65657ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/default/defaultBlockHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default {
'header-four': <h4 />,
'header-five': <h5 />,
'header-six': <h6 />,
'code-block': <pre />,
blockquote: <blockquote />,
'unordered-list-item': {
element: <li />,
Expand Down
11 changes: 11 additions & 0 deletions test/spec/convertToHTML-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ describe('convertToHTML', () => {
expect(result).toBe('<p>test paragraph</p>');
});

it('applies code block styles', () => {
const contentState = buildContentState([
{
type: 'code-block',
text: 'test code block',
},
]);
const result = convertToHTML(contentState);
expect(result).toBe('<pre>test code block</pre>');
});

it('applies style to multiple blocks', () => {
const contentState = buildContentState([
{
Expand Down

0 comments on commit 65657ef

Please sign in to comment.