Skip to content

Commit

Permalink
Use docs/ComponentName.md at the end of the component docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeux committed Mar 5, 2015
1 parent d935f45 commit b9ab607
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 3 additions & 1 deletion website/core/Marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,9 @@ marked.parse = marked;

var Marked = React.createClass({
render: function() {
return React.DOM.div(null, marked(this.props.children, this.props));
return this.props.children ?
React.DOM.div(null, marked(this.props.children, this.props)) :
null;
}
});

Expand Down
8 changes: 6 additions & 2 deletions website/layout/AutodocsLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ var Autodocs = React.createClass({
<Header level={4} className="propTitle" toSlug={name}>
{name}
{' '}
<span className="propType">{prop.type.name}</span></Header>
<Marked>{prop.description}</Marked>
{prop.type && <span className="propType">{prop.type.name}</span>}
</Header>
{prop.description && <Marked>{prop.description}</Marked>}
</div>
);
},
Expand All @@ -43,6 +44,9 @@ var Autodocs = React.createClass({
{content.description}
</Marked>
{this.renderProps(content.props)}
<Marked>
{content.fullDescription}
</Marked>
<div className="docs-prevnext">
{metadata.previous && <a className="docs-prev" href={metadata.previous + '.html#content'}>&larr; Prev</a>}
{metadata.next && <a className="docs-next" href={metadata.next + '.html#content'}>Next &rarr;</a>}
Expand Down
11 changes: 8 additions & 3 deletions website/server/extractDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ function docsToMarkdown(filepath, i) {
docs.resolver.findAllReactCreateClassCalls(node, recast)[0];
}
);

var componentName = getNameFromPath(filepath);

var docFilePath = '../docs/' + componentName + '.md';
if (fs.existsSync(docFilePath)) {
json.fullDescription = fs.readFileSync(docFilePath).toString();
}

var res = [
'---',
'id: ' + slugify(componentName),
Expand All @@ -37,15 +41,16 @@ function docsToMarkdown(filepath, i) {
}

var components = [
'../Libraries/Components/Navigation/NavigatorIOS.ios.js',
'../Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js',
'../Libraries/Text/ExpandingText.js',
'../Libraries/Image/Image.ios.js',
'../Libraries/Components/ListView/ListView.js',
'../Libraries/Components/Navigation/NavigatorIOS.ios.js',
'../Libraries/Components/ScrollView/ScrollView.ios.js',
'../Libraries/Text/Text.js',
'../Libraries/Image/Image.ios.js',
'../Libraries/Components/TextInput/TextInput.ios.js',
'../Libraries/Components/Touchable/TouchableHighlight.js',
'../Libraries/Components/Touchable/TouchableOpacity.js',
'../Libraries/Components/Touchable/TouchableWithoutFeedback.js',
'../Libraries/Components/View/View.js',
];
Expand Down

0 comments on commit b9ab607

Please sign in to comment.