import React from 'react';
import ReactMarkdown from 'react-markdown'
import { classes } from '/common/util';
import styles from './stylesheet.scss';
class MarkdownViewer extends React.Component {
render() {
const { className, source, onClickLink } = this.props;
const link = ({ href, ...rest }) => {
return /^https?:\/\//i.test(href) ? (
) : (
onClickLink(href)} {...rest} />
);
};
const image = ({ src, ...rest }) => {
let newSrc;
const codecogs = 'https://latex.codecogs.com/svg.latex?';
if (src.startsWith(codecogs)) {
const latex = src.substring(codecogs.length);
newSrc = `${codecogs}\\color{White}${latex}`;
} else {
newSrc = src;
}
return
};
return (
);
}
}
export default MarkdownViewer;