Skip to content

Commit

Permalink
fix(layer-info): set allowed types on markdown (#1286)
Browse files Browse the repository at this point in the history
  • Loading branch information
KatvonRivia authored Aug 18, 2023
1 parent d42b1cb commit c359b19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
15 changes: 2 additions & 13 deletions src/scripts/components/layers/layer-info/layer-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw';

import {LayerListItem} from '../../../types/layer-list';
import config from '../../../config/main';

import styles from './layer-info.module.styl';

Expand All @@ -15,23 +16,11 @@ const LayerInfo: FunctionComponent<Props> = ({layer}) => (
<span className={styles.layerType}>{layer.type}</span>
<h1 className={styles.layerTitle}>{layer.name}</h1>
<div className={styles.description}>
{/* eslint-disable-next-line react/no-children-prop */}
<ReactMarkdown
children={layer.description}
linkTarget="_blank"
rehypePlugins={[rehypeRaw]}
disallowedElements={[
'heading',
'text',
'paragraph',
'break',
'strong',
'emphasis',
'list',
'listItem',
'link',
'html'
]}
allowedElements={config.markdownAllowedElements}
/>
{layer.usageInfo && <p>{layer.usageInfo}</p>}
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/scripts/config/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export default {
'figcaption',
'li',
'ul',
'ol'
'ol',
'strong'
]
};

0 comments on commit c359b19

Please sign in to comment.