diff --git a/packages/hydrooj/src/lib/content.ts b/packages/hydrooj/src/lib/content.ts index f09d94b95..3337be70d 100644 --- a/packages/hydrooj/src/lib/content.ts +++ b/packages/hydrooj/src/lib/content.ts @@ -15,15 +15,15 @@ export function buildContent(source: ProblemSource, type: 'markdown' | 'html' = // required by upgrade 90_91 if (source instanceof Array) { return type === 'html' - ? source.map((node) => [ + ? source.flatMap((node) => [ node.type !== 'Plain' ? `
${node.payload[0]}`
+ `${node.payload[1]}`
: '',
node.text,
- ].join('\n')).join('\n')
- : source.map((node) => [
+ ]).join('\n')
+ : source.flatMap((node) => [
node.type !== 'Plain' && (node.type !== 'Sample' || !cnt) ? `## ${node.sectionTitle}` : '',
...node.type === 'Sample'
? [
@@ -41,7 +41,7 @@ export function buildContent(source: ProblemSource, type: 'markdown' | 'html' =
'',
node.text,
'',
- ].join('\n')).join('\n');
+ ]).join('\n');
}
return type === 'html'
? [
@@ -60,9 +60,9 @@ export function buildContent(source: ProblemSource, type: 'markdown' | 'html' =
...source.source ? [`