mirror of
https://github.com/DerTyp7/explainegy-nextjs.git
synced 2025-11-02 06:32:33 +01:00
add prisma
This commit is contained in:
41
app/tutorials/[articleName]/LoadMarkdown.tsx
Normal file
41
app/tutorials/[articleName]/LoadMarkdown.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
"use client";
|
||||
import React from "react";
|
||||
import { useEffect } from "react";
|
||||
|
||||
import Prism from "prismjs";
|
||||
import "../../../styles/prism_themes/prism-one-dark.css";
|
||||
//import "../../../styles/prism_themes/prism-one-light.css";
|
||||
|
||||
export default function LoadMarkdown() {
|
||||
useEffect(() => {
|
||||
document.querySelectorAll("pre").forEach((pre) => {
|
||||
if (pre.classList.length < 1) {
|
||||
pre.classList.add("language-");
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll("code").forEach((c) => {
|
||||
if (c.classList.length < 1) {
|
||||
c.classList.add("language-");
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll("blockquote").forEach((bq) => {
|
||||
bq.classList.add("blockquote");
|
||||
});
|
||||
|
||||
document.querySelectorAll("li").forEach((li) => {
|
||||
let paragraphText = "";
|
||||
li.querySelectorAll("p").forEach((p) => {
|
||||
paragraphText = p.innerHTML;
|
||||
});
|
||||
|
||||
if (paragraphText != "") {
|
||||
li.innerHTML = paragraphText;
|
||||
}
|
||||
});
|
||||
|
||||
Prism.highlightAll();
|
||||
}, []);
|
||||
return <div></div>;
|
||||
}
|
||||
Reference in New Issue
Block a user