aboutsummaryrefslogtreecommitdiffstats
path: root/webui
diff options
context:
space:
mode:
authorludovicm67 <ludovicmuller1@gmail.com>2020-01-23 21:36:49 +0100
committerludovicm67 <ludovicmuller1@gmail.com>2020-01-23 21:36:49 +0100
commit42219ab655090ea1194e1b8e280ed8e86b31abbe (patch)
tree4945f60b94b3b5e236e11420a9044644dcd5470d /webui
parent20080aa0e485412b07e1942798b264030e744381 (diff)
downloadgit-bug-42219ab655090ea1194e1b8e280ed8e86b31abbe.tar.gz
webui: custom image tag
Diffstat (limited to 'webui')
-rw-r--r--webui/src/Content.js7
-rw-r--r--webui/src/tag/ImageTag.js15
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