1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-09-03 14:22:41 +02:00

Fix markdown rendering

This commit is contained in:
Kamran Ahmed
2024-02-15 22:15:08 +00:00
parent a9734c7eeb
commit 8d677f3a22
2 changed files with 13 additions and 8 deletions

View File

@@ -2,6 +2,7 @@
import MarkdownIt from 'markdown-it';
export function markdownToHtml(markdown: string, isInline = true): string {
try {
const md = new MarkdownIt({
html: true,
linkify: true,
@@ -12,6 +13,9 @@ export function markdownToHtml(markdown: string, isInline = true): string {
} else {
return md.render(markdown);
}
} catch (e) {
return markdown;
}
}
// This is a workaround for the issue with tiptap-markdown extension

View File

@@ -81,6 +81,7 @@ export async function getAllQuestionGroups(): Promise<QuestionGroupType[]> {
if (answerText.endsWith('.md')) {
const answerFilePath = `/src/data/question-groups/${questionGroupDir}/content/${answerText}`;
answerText =
answerFilesMap[answerFilePath]?.default ||
answerFilesMap[answerFilePath] ||
`File missing: ${answerFilePath}`;