Skip to content

Commit

Permalink
feat: Pass format options in CodeBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jul 8, 2020
1 parent 0c6ca59 commit fc688ad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/CodeBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ const CodeBlock = ({
lineNumbers,
preview,
scope,
formatOptions,
}) => {
const components = { ...defaultComponents, ...componentOverrides };
const formattedCode = useFormattedCode(children.trim());
const formattedCode = useFormattedCode(children.trim(), formatOptions);
const [copied, copyCode] = useClipboard();
const [code, setCode] = useState(formattedCode);

Expand Down Expand Up @@ -91,6 +92,7 @@ CodeBlock.propTypes = {
}),
copy: PropTypes.bool,
children: PropTypes.string.isRequired,
formatOptions: PropTypes.object,
highlightedLines: PropTypes.string,
language: PropTypes.string,
lineNumbers: PropTypes.bool,
Expand Down

0 comments on commit fc688ad

Please sign in to comment.