|
@@ -19,11 +19,20 @@ class Markdown(Component):
|
|
|
|
|
|
def _get_imports(self):
|
|
|
imports = super()._get_imports()
|
|
|
- imports["@chakra-ui/react"] = {"Heading", "Code", "Text", "Link"}
|
|
|
+ imports["@chakra-ui/react"] = {
|
|
|
+ "Heading",
|
|
|
+ "Code",
|
|
|
+ "Text",
|
|
|
+ "Link",
|
|
|
+ "UnorderedList",
|
|
|
+ "OrderedList",
|
|
|
+ "ListItem",
|
|
|
+ }
|
|
|
imports["react-syntax-highlighter"] = {"Prism"}
|
|
|
imports["remark-math"] = {"remarkMath"}
|
|
|
imports["remark-gfm"] = {"remarkGfm"}
|
|
|
imports["rehype-katex"] = {"rehypeKatex"}
|
|
|
+ imports["rehype-raw"] = {"rehypeRaw"}
|
|
|
imports[""] = {"katex/dist/katex.min.css"}
|
|
|
return imports
|
|
|
|
|
@@ -35,9 +44,11 @@ class Markdown(Component):
|
|
|
"h1": "{({node, ...props}) => <Heading size='2xl' {...props} />}",
|
|
|
"h2": "{({node, ...props}) => <Heading size='xl' {...props} />}",
|
|
|
"h3": "{({node, ...props}) => <Heading size='lg' {...props} />}",
|
|
|
+ "ul": "{UnorderedList}",
|
|
|
+ "ol": "{OrderedList}",
|
|
|
+ "li": "{ListItem}",
|
|
|
"p": "{Text}",
|
|
|
"a": "{Link}",
|
|
|
- # "code": "{Code}"
|
|
|
"code": """{({node, inline, className, children, ...props}) =>
|
|
|
{
|
|
|
const match = (className || '').match(/language-(?<lang>.*)/);
|
|
@@ -57,6 +68,6 @@ class Markdown(Component):
|
|
|
),
|
|
|
},
|
|
|
remark_plugins=BaseVar(name="[remarkMath, remarkGfm]", type_=List[str]),
|
|
|
- rehype_plugins=BaseVar(name="[rehypeKatex]", type_=List[str]),
|
|
|
+ rehype_plugins=BaseVar(name="[rehypeKatex, rehypeRaw]", type_=List[str]),
|
|
|
src="",
|
|
|
)
|