File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ export function parseMdContent(md: string): TutorialFrame | never {
53
53
// Identify each part of the content
54
54
parts . forEach ( ( section : string ) => {
55
55
// match level
56
- const levelRegex = / ^ ( # { 2 } \s (?< levelId > L \d + ) \s (?< levelTitle > .* ) [ \n \r ] * ( > \s * (?< levelSummary > .* ) ) ? [ \n \r ] + (?< levelContent > [ ^ ] * ) ) / ;
56
+ const levelRegex = / ^ ( # { 2 } \s (?< levelId > L \d + ) \s (?< levelTitle > .* ) [ \n \r ] * ( > \s (?< levelSummary > .* ) ) ? [ \n \r ] + (?< levelContent > [ ^ ] * ) ) / ;
57
57
const levelMatch : RegExpMatchArray | null = section . match ( levelRegex ) ;
58
58
if ( levelMatch && levelMatch . groups ) {
59
59
const {
@@ -67,12 +67,13 @@ export function parseMdContent(md: string): TutorialFrame | never {
67
67
mdContent . levels [ levelId ] = {
68
68
id : levelId ,
69
69
title : levelTitle . trim ( ) ,
70
- summary : levelSummary
71
- ? levelSummary . trim ( )
72
- : truncate ( levelContent . split ( / [ \n \r ] + / ) [ 0 ] . trim ( ) , {
73
- length : 80 ,
74
- omission : "..." ,
75
- } ) ,
70
+ summary :
71
+ levelSummary && levelSummary . trim ( ) . length
72
+ ? levelSummary . trim ( )
73
+ : truncate ( levelContent . split ( / [ \n \r ] + / ) [ 0 ] . trim ( ) , {
74
+ length : 80 ,
75
+ omission : "..." ,
76
+ } ) ,
76
77
content : levelContent . trim ( ) ,
77
78
} ;
78
79
current = { level : levelId , step : "0" } ;
You can’t perform that action at this time.
0 commit comments