diff --git a/src/lib/markdown.ts b/src/lib/markdown.ts index e0a7b2905..474c08174 100644 --- a/src/lib/markdown.ts +++ b/src/lib/markdown.ts @@ -2,15 +2,19 @@ import MarkdownIt from 'markdown-it'; export function markdownToHtml(markdown: string, isInline = true): string { - const md = new MarkdownIt({ - html: true, - linkify: true, - }); + try { + const md = new MarkdownIt({ + html: true, + linkify: true, + }); - if (isInline) { - return md.renderInline(markdown); - } else { - return md.render(markdown); + if (isInline) { + return md.renderInline(markdown); + } else { + return md.render(markdown); + } + } catch (e) { + return markdown; } } diff --git a/src/lib/question-group.ts b/src/lib/question-group.ts index a3d211d49..e50eee1f6 100644 --- a/src/lib/question-group.ts +++ b/src/lib/question-group.ts @@ -81,6 +81,7 @@ export async function getAllQuestionGroups(): Promise { if (answerText.endsWith('.md')) { const answerFilePath = `/src/data/question-groups/${questionGroupDir}/content/${answerText}`; answerText = + answerFilesMap[answerFilePath]?.default || answerFilesMap[answerFilePath] || `File missing: ${answerFilePath}`;