Skip to content

Commit d2e1097

Browse files
committed
cleanup title/description parsing
Signed-off-by: shmck <[email protected]>
1 parent 53cf62c commit d2e1097

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/utils/parse.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ export function parseMdContent(md: string): TutorialFrame | never {
4141
const summaryMatch = parts
4242
.shift()
4343
.match(/^#\s(?<tutorialTitle>.*)[\n\r]+(?<tutorialDescription>[^]*)/);
44-
if (!summaryMatch.groups.tutorialTitle) {
45-
throw new Error("Missing tutorial title");
44+
if (summaryMatch.groups.tutorialTitle) {
45+
mdContent.summary.title = summaryMatch.groups.tutorialTitle.trim();
4646
}
47-
mdContent.summary.title = summaryMatch.groups.tutorialTitle.trim();
4847

49-
if (!summaryMatch.groups.tutorialDescription) {
50-
throw new Error("Missing tutorial summary description");
48+
if (summaryMatch.groups.tutorialDescription) {
49+
mdContent.summary.description = summaryMatch.groups.tutorialDescription.trim();
5150
}
52-
mdContent.summary.description = summaryMatch.groups.tutorialDescription.trim();
5351

5452
// Identify each part of the content
5553
parts.forEach((section: string) => {

0 commit comments

Comments
 (0)