Skip to content

Commit

Permalink
[storybook] Fix code markdown in withInfo() text
Browse files Browse the repository at this point in the history
  • Loading branch information
cjies committed Oct 13, 2017
1 parent f287a49 commit e624c42
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
17 changes: 17 additions & 0 deletions packages/storybook/.storybook/Code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';

/**
* - Workaround -
* Fix inline code markdown(`) in withInfo()'s text.
*
* @issue https://github.com/storybooks/storybook/issues/1662
*/
function Code({ children }) {
return (
<code style={{ backgroundColor: 'rgba(0, 0, 0, .05)' }}>
{children}
</code>
);
}

export default Code;
11 changes: 10 additions & 1 deletion packages/storybook/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { configure, setAddon } from '@storybook/react';
import { setOptions } from '@storybook/addon-options';
import infoAddon, { setDefaults } from '@storybook/addon-info';

import propsTableAddon from './propsTable-addon';
import Code from './Code';

// -------------------------------------
// Addons
Expand All @@ -15,7 +17,14 @@ setOptions({

setDefaults({
inline: true,
propTables: false
propTables: false,

/**
* Fix <Code> styling
*
* #FIXME: wait for storybooks/storybook#1501
*/
marksyConf: { code: Code }
});
setAddon(infoAddon);
setAddon(propsTableAddon);
Expand Down

0 comments on commit e624c42

Please sign in to comment.