@@ -30,17 +30,17 @@ function parseContent(md) {
30
30
const sections = { } ;
31
31
32
32
// 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 > [ ^ ] * ) / ) ;
34
34
35
35
sections [ 'summary' ] = {
36
- title :summaryMatch . groups . tutorialTitle ,
37
- description :summaryMatch . groups . tutorialDescription ,
36
+ title :summaryMatch . groups . tutorialTitle . trim ( ) ,
37
+ description :summaryMatch . groups . tutorialDescription . trim ( ) ,
38
38
} ;
39
39
40
40
// Identify each part of the content
41
41
parts . 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 > [ ^ ] * ) ) / ;
44
44
45
45
const levelMatch = section . match ( levelRegex ) ;
46
46
const stepMatch = section . match ( stepRegex ) ;
@@ -50,8 +50,8 @@ function parseContent(md) {
50
50
[ levelMatch . groups . levelId ] :{
51
51
id :levelMatch . groups . levelId ,
52
52
title :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 ( ) ,
55
55
}
56
56
} ;
57
57
@@ -66,7 +66,7 @@ function parseContent(md) {
66
66
[ stepMatch . groups . stepId ] :{
67
67
id :stepMatch . groups . stepId ,
68
68
// title: stepMatch.groups.stepTitle, //Not using at this momemnt
69
- content :stepMatch . groups . stepContent
69
+ content :stepMatch . groups . stepContent . trim ( )
70
70
}
71
71
}
72
72
}