_getInfoContent() { if (!this.props.info) { return ''; } const lines = this.props.info.split('\n'); while (lines[0].trim() === '') { lines.shift(); } let padding = 0; const matches = lines[0].match(/^ */); if (matches) { padding = matches[0].length; } const source = lines.map(s => s.slice(padding)).join('\n'); return ( <div style={stylesheet.infoContent}> {MTRC(source).tree} </div> ); }
function renderJSX(demoTemplate, templateParams, compilation) { demoTemplate = demoTemplate || ''; var tpl = fs.readFileSync(path.join(__dirname, 'lib/index_template.tpl'), 'utf8'); var readme = fs.readFileSync(path.join(__dirname, 'README.md'), 'utf8'); var replacements = { name: pkg.name, description: pkg.description, demo: demoTemplate, documentation: ReactDOM.renderToStaticMarkup( <div key="documentation">{MTRC(readme).tree}</div> ) }; return tpl.replace(/%(\w*)%/g, function(match) { var key = match.slice(1, -1); return replacements[key] ? replacements[key] : match; }); }
import theDebugger from './markdown/debugger.md'; import sharedModules from './markdown/shared_modules.md'; import angular2 from './markdown/angular2.md'; export default [ { label: 'Cerebral', icon: 'home', content: Home }, { label: 'Get Started', video: 'https://www.youtube.com/embed/dMvMts0nWNs', icon: 'power-off', text: getStarted.toLowerCase(), content: MTRC(getStarted).tree }, { label: 'Debugger', icon: 'bug', text: theDebugger.toLowerCase(), content: MTRC(theDebugger).tree, video: 'https://www.youtube.com/embed/ZMXcSRiq6fU' }, { label: 'Install', icon: 'download', text: install.toLowerCase(), content: MTRC(install).tree, subContent: [ { label: 'React', icon: 'television',
mixins: [Mixin], getStatePaths() { return { isSaving: ['isSaving'], file: ['file'] }; }, getInitialState() { return { markdown: null }; }, componentDidMount() { if (this.state.file.content) { this.setState({ markdown: MTRC(this.state.file.content).tree }); } }, componentWillUpdate(nextProps, nextState) { if (nextState.file.content !== this.state.file.content) { this.setState({ markdown: MTRC(nextState.file.content).tree }); } }, render() { return ( <Row className='show-grid' style={{height: '100%'}}> <Col md={6} style={PreviewStyle}> {this.state.markdown}