Small changes in Markdown component (#179)
This commit is contained in:
parent
3e8f6ffbb3
commit
9d16582c23
Binary file not shown.
@ -25,6 +25,7 @@
|
||||
"react-plotly.js": "^2.6.0",
|
||||
"react-syntax-highlighter": "^15.5.0",
|
||||
"rehype-katex": "^6.0.2",
|
||||
"rehype-raw": "^6.1.1",
|
||||
"remark-gfm": "^3.0.1",
|
||||
"remark-math": "^5.1.1"
|
||||
}
|
||||
|
@ -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="",
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user