Skip to content

Commit

Permalink
fix: markdown error
Browse files Browse the repository at this point in the history
  • Loading branch information
Argeare5 committed Mar 11, 2024
1 parent dbebda7 commit c814ddb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 45 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"react-countup": "^6.5.0",
"react-custom-scrollbars-2": "^4.5.0",
"react-dom": "18.2.0",
"react-emoji-render": "^2.0.1",
"react-final-form": "^6.5.9",
"react-final-form-arrays": "^3.1.4",
"react-loading-skeleton": "^3.4.0",
Expand Down
12 changes: 7 additions & 5 deletions src/ui/components/MarkdownContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ interface MarkdownContainerProps {
replaceImgSrc?: string;
}

const loadLang = async (langSlug: string) => {
const loadLang = (langSlug: string) => {
(typeof global !== 'undefined' ? global : window).Prism = Prism;
// @ts-ignore
await import(`prismjs/components/prism-${langSlug}`);
import(`prismjs/components/prism-${langSlug}`);
};

export function MarkdownContainer({
Expand Down Expand Up @@ -156,9 +156,11 @@ export function MarkdownContainer({
</Box>
);
},
pre: async ({ node, ...rest }) => {
const langSlug = rest.children.props.className.split('-')[1];
await loadLang(langSlug);
pre: ({ node, ...rest }) => {
const langSlug = !!rest.children.props.className
? rest.children.props.className.split('-')[1]
: 'markdown';
loadLang(langSlug);

return (
<Highlight
Expand Down
3 changes: 1 addition & 2 deletions src/ui/components/TextWithEmoji.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
ReactNode,
ReactPortal,
} from 'react';
import Emoji from 'react-emoji-render';

export interface TextWithEmojiProps {
children:
Expand All @@ -21,7 +20,7 @@ export interface TextWithEmojiProps {
export function TextWithEmoji({ children }: TextWithEmojiProps) {
return (
<Box
component={Emoji}
component="span"
sx={{
wordBreak: 'break-word',
'> span': { verticalAlign: 'top !important' },
Expand Down
39 changes: 2 additions & 37 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3812,11 +3812,6 @@ citty@^0.1.3, citty@^0.1.4:
dependencies:
consola "^3.2.3"

classnames@^2.2.5:
version "2.3.2"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924"
integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==

clean-css@^5.2.2:
version "5.3.2"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.2.tgz#70ecc7d4d4114921f5d298349ff86a31a9975224"
Expand Down Expand Up @@ -5717,7 +5712,7 @@ internal-slot@^1.0.5:
hasown "^2.0.0"
side-channel "^1.0.4"

invariant@2.2.4, invariant@^2.2.1:
invariant@2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
Expand Down Expand Up @@ -6325,11 +6320,6 @@ lodash.defaults@^4.2.0:
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==

lodash.flatten@^4.2.0, lodash.flatten@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f"
integrity sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==

lodash.isarguments@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a"
Expand All @@ -6340,11 +6330,6 @@ lodash.isequal@4.5.0:
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==

lodash.isstring@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
integrity sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==

lodash.merge@^4.6.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
Expand Down Expand Up @@ -7231,7 +7216,7 @@ process@^0.11.10:
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==

prop-types@^15, prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.8.1:
prop-types@^15, prop-types@^15.5.10, prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
Expand Down Expand Up @@ -7385,17 +7370,6 @@ react-dom@18.2.0, react-dom@^18.2.0:
loose-envify "^1.1.0"
scheduler "^0.23.0"

react-emoji-render@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/react-emoji-render/-/react-emoji-render-2.0.1.tgz#c02fb00f4421762e31a9a4c367068b3cdf2edaa2"
integrity sha512-SKtsdwgEf2BFNiE9y4UBFZBWjkRcyWmhMprVly52+J77/zxThcfaQ3sCA0+2LtGJIRMpm4DGWSvyLg72fd1rXQ==
dependencies:
classnames "^2.2.5"
emoji-regex "^8.0.0"
lodash.flatten "^4.4.0"
prop-types "^15.5.8"
string-replace-to-array "^1.0.1"

react-final-form-arrays@^3.1.4:
version "3.1.4"
resolved "https://registry.yarnpkg.com/react-final-form-arrays/-/react-final-form-arrays-3.1.4.tgz#2744941d8fd200fc648481022e515588f60bbac3"
Expand Down Expand Up @@ -8058,15 +8032,6 @@ string-natural-compare@^3.0.1:
resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4"
integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==

string-replace-to-array@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/string-replace-to-array/-/string-replace-to-array-1.0.3.tgz#c93eba999a5ee24d731aebbaf5aba36b5f18f7bf"
integrity sha512-QIdKvmfXbdFvblXAAz6IIjR7A+C6SU6m2A+e7fE/0EYDC5yfeWNMJQ193fPsW7nG+9q52dv/UjnVrDaNVZXpmQ==
dependencies:
invariant "^2.2.1"
lodash.flatten "^4.2.0"
lodash.isstring "^4.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
Expand Down

1 comment on commit c814ddb

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

This commit was deployed on ipfs

Please sign in to comment.