Skip to content

Commit

Permalink
fix: Fix empty code block handling (aws-amplify#6883)
Browse files Browse the repository at this point in the history
Fix error where an empty code block causes `preToCodeBlock` to throw
  • Loading branch information
palpatim authored Feb 5, 2024
1 parent a1c8938 commit 55b9fbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/pre-to-code-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = function preToCodeBlock(preProps) {
const { title, highlight, showLineNumbers } = preProps;
const { children, className } = preProps.children.props;
return {
codeString: children.trim(),
codeString: children ? children.trim() : '',
highlight,
language: className && className.split('-')[1],
showLineNumbers,
Expand Down

0 comments on commit 55b9fbf

Please sign in to comment.