Skip to content

Commit

Permalink
add support for external images in chat #235
Browse files Browse the repository at this point in the history
  • Loading branch information
joneugster committed Jun 10, 2024
1 parent f158250 commit 4652f6d
Show file tree
Hide file tree
Showing 4 changed files with 435 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import * as React from 'react';
import ReactMarkdown from 'react-markdown';
import remarkMath from 'remark-math'
import rehypeKatex from 'rehype-katex'
import rehypeRaw from 'rehype-raw'
import 'katex/dist/katex.min.css' // `rehype-katex` does not import the CSS for you
import gfm from "remark-gfm";

function Markdown(props) {
const newProps = {
...props,
remarkPlugins: [...props.remarkPlugins ?? [], remarkMath, gfm],
rehypePlugins: [...props.remarkPlugins ?? [], rehypeKatex],
rehypePlugins: [...props.remarkPlugins ?? [], rehypeKatex, rehypeRaw],
};
return (
<ReactMarkdown {...newProps} className="markdown" />
Expand Down
14 changes: 14 additions & 0 deletions doc/hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,17 @@ $$
```

See https://www.jmilne.org/not/Mamscd.pdf

### Images

Hints and introductions/conclusions can also contain images.

For remote images, simply add:

```
<img src=\"https://url.com/to/image\"/>
```

Local images can currently only be included with a hack:

Images in the game's `images/` folder will be accessible at `data/g/[user]/[repo]/[image].[png|jpg|…]` and thus can be included as if they were external images.
Loading

0 comments on commit 4652f6d

Please sign in to comment.