Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced deprecated markdown-to-react-components with marksy #1188

Merged
merged 3 commits into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@storybook/addons": "^3.0.0",
"babel-runtime": "^6.23.0",
"markdown-to-react-components": "^0.2.1",
"marksy": "^1.0.1",
"prop-types": "^15.5.8",
"react-addons-create-fragment": "^15.5.3"
},
Expand Down
10 changes: 5 additions & 5 deletions addons/info/src/components/Story.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import MTRC from 'markdown-to-react-components';
import marksy from 'marksy';
import PropTable from './PropTable';
import Node from './Node';
import { baseFonts } from './theme';
Expand Down Expand Up @@ -90,7 +90,7 @@ export default class Story extends React.Component {
open: false,
stylesheet: this.props.styles(JSON.parse(JSON.stringify(stylesheet))),
};
MTRC.configure(this.props.mtrcConf);
this.marksy = marksy(this.props.mtrcConf);
}

componentWillReceiveProps(nextProps) {
Expand Down Expand Up @@ -211,7 +211,7 @@ export default class Story extends React.Component {
const source = lines.map(s => s.slice(padding)).join('\n');
return (
<div style={this.state.stylesheet.infoContent}>
{MTRC(source).tree}
{this.marksy(source).tree}
</div>
);
}
Expand Down Expand Up @@ -340,12 +340,12 @@ Story.propTypes = {
showSource: PropTypes.bool,
styles: PropTypes.func.isRequired,
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
mtrcConf: PropTypes.object,
marksyConf: PropTypes.object,
};

Story.defaultProps = {
showInline: false,
showHeader: true,
showSource: true,
mtrcConf: {},
marksyConf: {},
};
10 changes: 5 additions & 5 deletions addons/info/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const defaultOptions = {
propTables: [],
};

const defaultMtrcConf = {
const defaultMarksyConf = {
h1: H1,
h2: H2,
h3: H3,
Expand Down Expand Up @@ -48,9 +48,9 @@ export default {
options.propTables = null;
}

const mtrcConf = { ...defaultMtrcConf };
if (options && options.mtrcConf) {
Object.assign(mtrcConf, options.mtrcConf);
const marksyConf = { ...defaultMarksyConf };
if (options && options.marksyConf) {
Object.assign(marksyConf, options.marksyConf);
}

return this.add(storyName, context => {
Expand All @@ -63,7 +63,7 @@ export default {
propTables: options.propTables,
propTablesExclude: options.propTablesExclude,
styles: typeof options.styles === 'function' ? options.styles : s => s,
mtrcConf,
marksyConf,
};

return (
Expand Down