@@ -30,17 +30,17 @@ function parseContent(md) {
3030const sections = { } ;
3131
3232// Identify and remove the header
33- const summaryMatch = parts . shift ( ) . match ( / ^ # \s (?< tutorialTitle > .* ) \n + (?< tutorialDescription > [ ^ ] * ) / ) ;
33+ const summaryMatch = parts . shift ( ) . match ( / ^ # \s (?< tutorialTitle > .* ) [ \n \r ] + (?< tutorialDescription > [ ^ ] * ) / ) ;
3434
3535sections [ 'summary' ] = {
36- title :summaryMatch . groups . tutorialTitle ,
37- description :summaryMatch . groups . tutorialDescription ,
36+ title :summaryMatch . groups . tutorialTitle . trim ( ) ,
37+ description :summaryMatch . groups . tutorialDescription . trim ( ) ,
3838} ;
3939
4040// Identify each part of the content
4141parts . forEach ( section => {
42- const levelRegex = / ^ ( # # \s (?< levelId > L \d + ) \s (?< levelTitle > .* ) \n * ( > \s * (?< levelSummary > .* ) ) ? \n + (?< levelContent > [ ^ ] * ) ) / ;
43- const stepRegex = / ^ ( # # # \s (?< stepId > (?< levelId > L \d + ) S \d + ) \s (?< stepTitle > .* ) \n + (?< stepContent > [ ^ ] * ) ) / ;
42+ const levelRegex = / ^ ( # # \s (?< levelId > L \d + ) \s (?< levelTitle > .* ) [ \n \r ] * ( > \s + (?< levelSummary > .* ) ) ? [ \n \r ] + (?< levelContent > [ ^ ] * ) ) / ;
43+ const stepRegex = / ^ ( # # # \s (?< stepId > (?< levelId > L \d + ) S \d + ) \s (?< stepTitle > .* ) [ \n \r ] + (?< stepContent > [ ^ ] * ) ) / ;
4444
4545const levelMatch = section . match ( levelRegex ) ;
4646const stepMatch = section . match ( stepRegex ) ;
@@ -50,8 +50,8 @@ function parseContent(md) {
5050[ levelMatch . groups . levelId ] :{
5151id :levelMatch . groups . levelId ,
5252title :levelMatch . groups . levelTitle ,
53- summary :levelMatch . groups . levelSummary ,
54- content :levelMatch . groups . levelContent ,
53+ summary :levelMatch . groups . levelSummary . trim ( ) ,
54+ content :levelMatch . groups . levelContent . trim ( ) ,
5555}
5656} ;
5757
@@ -66,7 +66,7 @@ function parseContent(md) {
6666[ stepMatch . groups . stepId ] :{
6767id :stepMatch . groups . stepId ,
6868// title: stepMatch.groups.stepTitle, //Not using at this momemnt
69- content :stepMatch . groups . stepContent
69+ content :stepMatch . groups . stepContent . trim ( )
7070}
7171}
7272}