diff --git a/src/runtime/server/api/highlight.ts b/src/runtime/server/api/highlight.ts index 30f8543c7..29150dab0 100644 --- a/src/runtime/server/api/highlight.ts +++ b/src/runtime/server/api/highlight.ts @@ -40,7 +40,13 @@ const resolveTheme = (theme: string | Record): Record) => { // Assert body schema - if (typeof body.code !== 'string') { throw createError({ statusMessage: 'Bad Request', statusCode: 400, message: 'Missing code key.' }) } + if (typeof body.code !== 'string') { + // TODO: Maybe remove this hotfix? + // I could not reproduce the issue with local content, but it might happen when using `parseContent` or external content sources. + body.code = '' + + // throw createError({ statusMessage: 'Bad Request', statusCode: 400, message: 'Missing code key.' }) + } return { // Remove trailing carriage returns diff --git a/src/runtime/server/storage.ts b/src/runtime/server/storage.ts index d1b3d56bb..8f126e4a5 100644 --- a/src/runtime/server/storage.ts +++ b/src/runtime/server/storage.ts @@ -10,7 +10,9 @@ import { transformContent } from '../transformers' import type { ModuleOptions } from '../../module' import { getPreview, isPreview } from './preview' // eslint-disable-next-line import/named +// @ts-ignore import { useNitroApp, useRuntimeConfig, useStorage } from '#imports' +// @ts-ignore import { transformers as customTransformers } from '#content/virtual/transformers' interface ParseContentOptions {