diff options
Diffstat (limited to 'webui')
-rw-r--r-- | webui/src/Content.js | 7 | ||||
-rw-r--r-- | webui/src/tag/ImageTag.js | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/webui/src/Content.js b/webui/src/Content.js index 19f57631..737c5ab2 100644 --- a/webui/src/Content.js +++ b/webui/src/Content.js @@ -2,12 +2,17 @@ import unified from 'unified'; import parse from 'remark-parse'; import html from 'remark-html'; import remark2react from 'remark-react'; +import ImageTag from './tag/ImageTag'; const Content = ({ markdown }) => { const processor = unified() .use(parse) .use(html) - .use(remark2react); + .use(remark2react, { + remarkReactComponents: { + img: ImageTag, + }, + }); return processor.processSync(markdown).contents; }; diff --git a/webui/src/tag/ImageTag.js b/webui/src/tag/ImageTag.js new file mode 100644 index 00000000..aea65e9d --- /dev/null +++ b/webui/src/tag/ImageTag.js @@ -0,0 +1,15 @@ +import React from 'react'; +import { makeStyles } from '@material-ui/styles'; + +const useStyles = makeStyles({ + tag: { + maxWidth: '100%', + }, +}); + +const ImageTag = (props) => { + const classes = useStyles(); + return <img className={classes.tag} {...props} /> +}; + +export default ImageTag;
\ No newline at end of file |