add: auto link feature
This commit is contained in:
@@ -8,12 +8,18 @@ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
||||
import { okaidia } from "react-syntax-highlighter/dist/esm/styles/prism";
|
||||
import "katex/dist/katex.min.css";
|
||||
import "./MarkdownView.css";
|
||||
import {useLinks} from "../../utils/markdown-queries";
|
||||
|
||||
const MarkdownView = ({ content, height="auto" }) => {
|
||||
const {data: links, isLoading} = useLinks();
|
||||
|
||||
if (isLoading)
|
||||
return <p>Loading...</p>
|
||||
const definitions = "\n<!-- Definitions -->\n" + links.join("\n");
|
||||
return (
|
||||
<div className="markdown-preview" style={{height}}>
|
||||
<ReactMarkdown
|
||||
children={content}
|
||||
children={content + "\n" + definitions}
|
||||
remarkPlugins={[remarkMath, remarkGfm]}
|
||||
rehypePlugins={[rehypeKatex, rehypeRaw]}
|
||||
components={{
|
||||
|
||||
Reference in New Issue
Block a user