diff --git a/packages/hydrooj/src/lib/content.ts b/packages/hydrooj/src/lib/content.ts index 3337be70d..b777c4177 100644 --- a/packages/hydrooj/src/lib/content.ts +++ b/packages/hydrooj/src/lib/content.ts @@ -48,7 +48,7 @@ export function buildContent(source: ProblemSource, type: 'markdown' | 'html' = ...source.description ? [`
`,
sample[0],
``,
@@ -63,14 +63,14 @@ export function buildContent(source: ProblemSource, type: 'markdown' | 'html' =
...source.description ? [`## ${_('Description')}`, '', source.description, ''] : [],
...source.input ? [`## ${_('Input Format')}`, '', source.input, ''] : [],
...source.output ? [`## ${_('Output Format')}`, '', source.output, ''] : [],
- ...(source.samples).map((sample, i) => [
+ ...(source.samples || []).flatMap((sample, i) => [
`\`\`\`input${i + 1}`,
sample[0],
'```',
`\`\`\`output${i + 1}`,
sample[1],
'```',
- ].join('\n')),
+ ]),
...source.samplesRaw ? [source.samplesRaw] : [],
...source.hint ? [`## ${_('Hint')}`, '', source.hint, ''] : [],
...source.source ? [`## ${_('Source')}`, '', source.source, ''] : [],