diff --git a/packages/styleguide/src/components/MDX/MDX.js b/packages/styleguide/src/components/MDX/MDX.js
index 081204f20d9..c49fc4463ef 100644
--- a/packages/styleguide/src/components/MDX/MDX.js
+++ b/packages/styleguide/src/components/MDX/MDX.js
@@ -36,7 +36,10 @@ export const MDXComponents = {
a: props => ,
inlineCode: props =>
,
code: props => (
-
+
),
};
diff --git a/packages/styleguide/src/components/Preview/CodeExample.js b/packages/styleguide/src/components/Preview/CodeExample.js
index 3044617e753..28f48aa1bfa 100644
--- a/packages/styleguide/src/components/Preview/CodeExample.js
+++ b/packages/styleguide/src/components/Preview/CodeExample.js
@@ -167,7 +167,7 @@ export default class CodeExample extends React.Component {
}
render() {
- const { children, codeJSXOptions, codeTypes, theme, ...other } = this.props;
+ const { children, codeJSXOptions, codeTypes, ...other } = this.props;
let codeToShow;
switch (this.state.codePreviewType) {
@@ -175,10 +175,7 @@ export default class CodeExample extends React.Component {
codeToShow = pretty(
typeof children === 'string'
? unescape(children)
- : renderToStaticMarkup({
- ...children,
- props: { ...children.props, theme },
- }),
+ : renderToStaticMarkup(children),
{
ocd: true,
}
@@ -214,6 +211,7 @@ export default class CodeExample extends React.Component {
{
const { getByText } = render(Preview);
expect(getByText('Preview')).toBeInTheDocument();
});
+
+ it('HTML preview renders more than 1 child', () => {
+ const { getByText, getByTestId } = render(
+
+ Paragraph 1
+ Paragraph 2
+
+ );
+
+ fireEvent.click(getByText('SHOW CODE'));
+
+ fireEvent.click(getByText('HTML'));
+
+ expect(getByTestId('html')).toBeInTheDocument();
+ });
});