Skip to content

Commit

Permalink
Add markdown support for prop comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Jun 30, 2015
1 parent 3131bc3 commit 86f5936
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/generate-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import metadata from 'react-component-metadata';
import glob from 'glob';
import fsp from 'fs-promise';
import promisify from '../tools/promisify';
import marked from 'marked';

marked.setOptions({
xhtml: true
});

let globp = promisify(glob);

Expand All @@ -23,6 +28,7 @@ let isLiteral = str => str.trim()[0] === '"' || str.trim()[0] === "'";
function parseDoclets(obj){
obj.doclets = metadata.parseDoclets(obj.desc || '');
obj.desc = cleanDoclets(obj.desc || '');
obj.descHtml = marked(obj.desc || '');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion docs/src/PropTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const PropTable = React.createClass({
<div>{this.getType(prop)}</div>
</td>
<td>{prop.defaultValue}</td>
<td>{prop.desc}</td>
<td dangerouslySetInnerHTML={{__html: prop.descHtml }}></td>
</tr>
);
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"less": "^2.4.0",
"less-loader": "^2.1.0",
"lodash": "^3.5.0",
"marked": "^0.3.3",
"mocha": "^2.2.1",
"mt-changelog": "^0.5.2",
"node-libs-browser": "^0.5.2",
Expand Down

0 comments on commit 86f5936

Please sign in to comment.