CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/components/misc/sanitized-markdown.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { CSSProperties } from "react";
7
8
import Markdown from "@cocalc/frontend/editors/slate/static-markdown";
9
import { FileContext, IFileContext } from "@cocalc/frontend/lib/file-context";
10
import A from "components/misc/A";
11
12
export default function SanitizedMarkdown({
13
style,
14
value,
15
anchorStyle,
16
}: {
17
style?: CSSProperties;
18
anchorStyle?: CSSProperties;
19
value: string;
20
}) {
21
const ctx: IFileContext = {
22
AnchorTagComponent: A,
23
noSanitize: false,
24
anchorStyle,
25
};
26
return (
27
<FileContext.Provider value={ctx}>
28
<Markdown value={value} style={style} />
29
</FileContext.Provider>
30
);
31
}
32
33