import Markdown from "react-markdown"; import SyntaxHighlighter from "react-syntax-highlighter"; import { atomOneDark } from "react-syntax-highlighter/dist/esm/styles/hljs"; import { useTranslation } from "react-i18next"; import { I18nKey } from "#/i18n/declaration"; import { JupyterLine } from "#/utils/parse-cell-content"; import { paragraph } from "../markdown/paragraph"; interface JupyterCellOutputProps { lines: JupyterLine[]; } export function JupyterCellOutput({ lines }: JupyterCellOutputProps) { const { t } = useTranslation(); return (
{/* display the lines as plaintext or image */}
{lines.map((line, index) => {
if (line.type === "image") {
// Use markdown to display the image
const imageMarkdown = line.url
? ``
: line.content;
return (
value}
>
{imageMarkdown}
);
}
return (
{line.content}
);
})}