Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd2e1097

Browse files
committed
cleanup title/description parsing
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent53cf62c commitd2e1097

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

‎src/utils/parse.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ export function parseMdContent(md: string): TutorialFrame | never {
4141
constsummaryMatch=parts
4242
.shift()
4343
.match(/^#\s(?<tutorialTitle>.*)[\n\r]+(?<tutorialDescription>[^]*)/);
44-
if(!summaryMatch.groups.tutorialTitle){
45-
thrownewError("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-
thrownewError("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)

[8]ページ先頭

©2009-2025 Movatter.jp