File tree Expand file tree Collapse file tree
src/frontend/components/App Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8989 "redbox-react" : " ^1.5.0" ,
9090 "redux" : " ^4.0.0" ,
9191 "redux-actions" : " ^2.2.1" ,
92+ "remove-markdown" : " ^0.3.0" ,
9293 "sass-loader" : " ^7.0.3" ,
9394 "screenfull" : " ^3.3.2" ,
9495 "style-loader" : " ^0.21.0" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { connect } from 'react-redux';
44import Promise from 'bluebird' ;
55import { Helmet } from 'react-helmet' ;
66import AutosizeInput from 'react-input-autosize' ;
7+ import removeMarkdown from 'remove-markdown' ;
78import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
89import faPlus from '@fortawesome/fontawesome-free-solid/faPlus' ;
910import {
@@ -228,8 +229,12 @@ class App extends BaseComponent {
228229 const { files } = this . props . current ;
229230 const readmeFile = files . find ( file => file . name === 'README.md' ) ;
230231 if ( ! readmeFile ) return '' ;
231- const groups = / ^ \s * # .* \n + ( [ ^ \n ] + ) / . exec ( readmeFile . content ) ;
232- return groups && groups [ 1 ] || '' ;
232+ const lines = readmeFile . content . split ( '\n' ) ;
233+ lines . shift ( ) ;
234+ while ( lines . length && ! lines [ 0 ] . trim ( ) ) lines . shift ( ) ;
235+ let descriptionLines = [ ] ;
236+ while ( lines . length && lines [ 0 ] . trim ( ) ) descriptionLines . push ( lines . shift ( ) ) ;
237+ return removeMarkdown ( descriptionLines . join ( ' ' ) ) ;
233238 }
234239
235240 render ( ) {
You can’t perform that action at this time.
0 commit comments