UNPKG

@mintlify/prebuild

Version:

Helpful functions for Mintlify's prebuild step

14 lines (13 loc) 540 B
import { coreRemark } from '@mintlify/common'; import { formatError } from '../../errorMessages/formatError.js'; export const preparseMdx = async (fileContent, contentDirectoryPath, filePath, suppressErrLog = false) => { try { return String(await coreRemark().process(fileContent)); } catch (error) { if (!suppressErrLog) { console.error(formatError(error, filePath, contentDirectoryPath)); } return `🚧 A parsing error occured. Please contact the owner of this website.`; } };