mirror of
https://github.com/withastro/astro.git
synced 2025-02-17 22:44:24 -05:00
fix: properly show mdoc errors in overlay
This commit is contained in:
parent
ec003b5b53
commit
83af723ac5
1 changed files with 4 additions and 0 deletions
|
@ -125,6 +125,7 @@ export interface AstroErrorPayload {
|
|||
// Shiki does not support `mjs` or `cjs` aliases by default.
|
||||
// Map these to `.js` during error highlighting.
|
||||
const ALTERNATIVE_JS_EXTS = ['cjs', 'mjs'];
|
||||
const ALTERNATIVE_MD_EXTS = ['mdoc'];
|
||||
|
||||
/**
|
||||
* Generate a payload for Vite's error overlay
|
||||
|
@ -158,6 +159,9 @@ export async function getViteErrorPayload(err: ErrorWithMetadata): Promise<Astro
|
|||
if (ALTERNATIVE_JS_EXTS.includes(highlighterLang ?? '')) {
|
||||
highlighterLang = 'js';
|
||||
}
|
||||
if (ALTERNATIVE_MD_EXTS.includes(highlighterLang ?? '')) {
|
||||
highlighterLang = 'md';
|
||||
}
|
||||
const highlightedCode = err.fullCode
|
||||
? highlighter.codeToHtml(err.fullCode, {
|
||||
lang: highlighterLang,
|
||||
|
|
Loading…
Add table
Reference in a new issue