Skip to content

Commit

Permalink
Deps - Upgrade markdown-to-jsx (MAJOR) + remove TS types (now include…
Browse files Browse the repository at this point in the history
…d since v7) + adapt use of MarkdownOptions by MarkdownToJSX.Options
  • Loading branch information
Vadorequest committed Jan 10, 2021
1 parent e13497b commit 3610561
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"lodash.some": "4.6.0",
"lodash.startswith": "4.2.1",
"lodash.xorby": "4.7.0",
"markdown-to-jsx": "6.11.3",
"markdown-to-jsx": "7.1.1",
"next": "10.0.0",
"next-cookies": "2.0.3",
"prop-types": "15.7.2",
Expand Down Expand Up @@ -186,7 +186,6 @@
"@types/lodash.some": "4.6.6",
"@types/lodash.startswith": "4.2.6",
"@types/lodash.xorby": "4.7.6",
"@types/markdown-to-jsx": "6.11.3",
"@types/popper.js": "1.11.0",
"@types/react": "17.0.0",
"@types/react-test-renderer": "17.0.0",
Expand Down
12 changes: 6 additions & 6 deletions src/components/utils/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as Sentry from '@sentry/node';
import { createLogger } from '@unly/utils-simple-logger';
import classnames from 'classnames';
import deepmerge from 'deepmerge';
import MarkdownToJSX, { MarkdownOptions } from 'markdown-to-jsx';
import MarkdownToJSXLib, { MarkdownToJSX } from 'markdown-to-jsx';
import React, { Fragment } from 'react';
import {
Alert,
Expand All @@ -21,7 +22,6 @@ import { Markdown as MarkdownType } from '../../types/Markdown';
import I18nBtnChangeLocale from '../i18n/I18nBtnChangeLocale';
import I18nLink from '../i18n/I18nLink';
import Tooltip from './SimpleTooltip';
import classnames from 'classnames';

const fileLabel = 'components/utils/Markdown';
const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-eslint/no-unused-vars
Expand All @@ -30,12 +30,12 @@ const logger = createLogger({ // eslint-disable-line no-unused-vars,@typescript-

type Props = {
text: MarkdownType;
markdownOptions?: MarkdownOptions;
markdownOptions?: MarkdownToJSX.Options;
style?: CSSStyles;
className?: string;
}

const defaultMarkdownOptions: MarkdownOptions = {
const defaultMarkdownOptions: MarkdownToJSX.Options = {
// Make some of our own components available
overrides: { // See https://github.com/probablyup/markdown-to-jsx#optionsoverrides---override-any-html-tags-representation
// All links should open in a new tab, and ensure proper security by default
Expand Down Expand Up @@ -88,11 +88,11 @@ const Markdown: React.FunctionComponent<Props> = (props): JSX.Element => {
style={style}
className={classnames('markdown-container', className)}
>
<MarkdownToJSX
<MarkdownToJSXLib
options={markdownOptions}
>
{text}
</MarkdownToJSX>
</MarkdownToJSXLib>
</div>
);

Expand Down
20 changes: 5 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3205,13 +3205,6 @@
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.149.tgz#1342d63d948c6062838fbf961012f74d4e638440"
integrity sha512-ijGqzZt/b7BfzcK9vTrS6MFljQRPn5BFWOx8oE0GYxribu6uV+aA9zZuXI1zc/etK9E8nrgdoF2+LgUw7+9tJQ==

"@types/markdown-to-jsx@6.11.3":
version "6.11.3"
resolved "https://registry.yarnpkg.com/@types/markdown-to-jsx/-/markdown-to-jsx-6.11.3.tgz#cdd1619308fecbc8be7e6a26f3751260249b020e"
integrity sha512-30nFYpceM/ZEvhGiqWjm5quLUxNeld0HCzJEXMZZDpq53FPkS85mTwkWtCXzCqq8s5JYLgM5W392a02xn8Bdaw==
dependencies:
"@types/react" "*"

"@types/mime@*":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.1.tgz#dc488842312a7f075149312905b5e3c0b054c79d"
Expand Down Expand Up @@ -10079,13 +10072,10 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"

markdown-to-jsx@6.11.3:
version "6.11.3"
resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.11.3.tgz#98156a0a87455b36019435893029eb5e31d1d2b2"
integrity sha512-YF2n1Yv7yrQZXzotsbnlcEuU+Plz9bAiNp5HSTqbydrheDBuNX4RbVwKGUxOWv8UhD92HCpSSntVZHQhMcxcnw==
dependencies:
prop-types "^15.6.2"
unquote "^1.1.0"
markdown-to-jsx@7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-7.1.1.tgz#269145a585650258691a9a1ec9fb4b273ed2d32a"
integrity sha512-PJgNmvdKM7f7dFDgr4N2ZQv5OuJ2dwwBZvKel61BO7JLh2QQLDs880uQO+OjsEKNmhCZ0ZOIKkCXFEuY9G0yEA==

md5.js@^1.3.4:
version "1.3.5"
Expand Down Expand Up @@ -14222,7 +14212,7 @@ universalify@^1.0.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"
integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==

unquote@^1.1.0, unquote@~1.1.1:
unquote@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/unquote/-/unquote-1.1.1.tgz#8fded7324ec6e88a0ff8b905e7c098cdc086d544"
integrity sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=
Expand Down

1 comment on commit 3610561

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.