Skip to content

Commit fba89b5

Browse files
committed
design: 마크다운 스타일 수정
1 parent 644f2ce commit fba89b5

File tree

5 files changed

+25
-56
lines changed

5 files changed

+25
-56
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"date-fns": "2.10.0",
1111
"github-markdown-css": "^5.2.0",
1212
"gray-matter": "4.0.2",
13+
"highlight.js": "^11.9.0",
1314
"next": "^13.5.2",
14-
"prismjs": "^1.22.0",
1515
"react": "^18.2.0",
1616
"react-dom": "^18.2.0",
1717
"remark": "11.0.2",
@@ -21,7 +21,6 @@
2121
"@types/classnames": "^2.2.10",
2222
"@types/gtag.js": "^0.0.14",
2323
"@types/node": "^14.0.1",
24-
"@types/prismjs": "^1.16.2",
2524
"@types/react": "^18.2.22",
2625
"@types/react-dom": "^18.2.7",
2726
"@typescript-eslint/eslint-plugin": "^6.7.2",

src/components/post/Content.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
'use client';
22

3-
import Prism from 'prismjs';
3+
import hljs from 'highlight.js/lib/core';
4+
import javascript from 'highlight.js/lib/languages/javascript';
5+
import json from 'highlight.js/lib/languages/json';
6+
import typescript from 'highlight.js/lib/languages/typescript';
7+
import yaml from 'highlight.js/lib/languages/yaml';
48
import { useEffect } from 'react';
5-
6-
import 'prismjs/components/prism-typescript';
7-
import 'prismjs/components/prism-jsx';
8-
import 'prismjs/components/prism-tsx';
99
import '@styles/markdown.css';
10+
import 'highlight.js/styles/vs.css';
11+
12+
hljs.registerLanguage('javascript', javascript);
13+
hljs.registerLanguage('typescript', typescript);
14+
hljs.registerLanguage('json', json);
15+
hljs.registerLanguage('yaml', yaml);
1016

1117
interface Props {
1218
content: string;
1319
}
1420

1521
const Content = ({ content }: Props) => {
1622
useEffect(() => {
17-
Prism.highlightAll();
23+
hljs.highlightAll();
1824
}, []);
1925

2026
return <div className="mt-5 markdown-body" dangerouslySetInnerHTML={{ __html: content }} />;

src/styles/index.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@import './prism-vsc-dark-plus.css';
2-
31
@tailwind base;
42
@tailwind components;
53
@tailwind utilities;

src/styles/markdown.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@
103103
.markdown-body img {
104104
border-style: none;
105105
max-width: 100%;
106-
box-sizing: content-box;
107-
background-color: #ffffff;
106+
box-sizing: border-box;
107+
background: linear-gradient(#ff87c6, #ffdfff);
108+
padding: 20px;
109+
border-radius: 6px;
110+
margin: 10px 0;
108111
}
109112

110113
.markdown-body code,
@@ -312,6 +315,7 @@
312315
.markdown-body p {
313316
margin-top: 0;
314317
margin-bottom: 10px;
318+
line-height: 1.6;
315319
}
316320

317321
.markdown-body blockquote {
@@ -757,7 +761,7 @@
757761
overflow: visible;
758762
line-height: inherit;
759763
word-wrap: normal;
760-
background-color: transparent;
764+
background-color: #f6f8fa;
761765
border: 0;
762766
}
763767

yarn.lock

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,6 @@
222222
resolved "https://registry.npmjs.org/@types/node/-/node-14.14.2.tgz#d25295f9e4ca5989a2c610754dc02a9721235eeb"
223223
integrity sha512-jeYJU2kl7hL9U5xuI/BhKPZ4vqGM/OmK6whiFAXVhlstzZhVamWhDSmHyGLIp+RVyuF9/d0dqr2P85aFj4BvJg==
224224

225-
"@types/prismjs@^1.16.2":
226-
version "1.16.2"
227-
resolved "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.16.2.tgz#c130c977191c988cb35e97585da5d580948cc2d2"
228-
integrity sha512-1M/j21xgTde7RPtpJVQebW5rzrquj7S+wnqt4x9uWrIPpr0Ya/uXypcqC2aUQL5gtLXFCKSH7GnjfAijMdfbuA==
229-
230225
"@types/prop-types@*":
231226
version "15.7.3"
232227
resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7"
@@ -690,15 +685,6 @@ client-only@0.0.1:
690685
resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1"
691686
integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==
692687

693-
clipboard@^2.0.0:
694-
version "2.0.6"
695-
resolved "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz#52921296eec0fdf77ead1749421b21c968647376"
696-
integrity sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==
697-
dependencies:
698-
good-listener "^1.2.2"
699-
select "^1.1.2"
700-
tiny-emitter "^2.0.0"
701-
702688
collapse-white-space@^1.0.0, collapse-white-space@^1.0.2:
703689
version "1.0.6"
704690
resolved "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.6.tgz#e63629c0016665792060dbbeb79c42239d2c5287"
@@ -846,11 +832,6 @@ define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0, de
846832
has-property-descriptors "^1.0.0"
847833
object-keys "^1.1.1"
848834

849-
delegate@^3.1.2:
850-
version "3.2.0"
851-
resolved "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166"
852-
integrity sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==
853-
854835
dequal@^2.0.3:
855836
version "2.0.3"
856837
resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be"
@@ -1466,13 +1447,6 @@ globby@^11.1.0:
14661447
merge2 "^1.4.1"
14671448
slash "^3.0.0"
14681449

1469-
good-listener@^1.2.2:
1470-
version "1.2.2"
1471-
resolved "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50"
1472-
integrity sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=
1473-
dependencies:
1474-
delegate "^3.1.2"
1475-
14761450
gopd@^1.0.1:
14771451
version "1.0.1"
14781452
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c"
@@ -1584,6 +1558,11 @@ hast-util-whitespace@^1.0.0:
15841558
resolved "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-1.0.4.tgz#e4fe77c4a9ae1cb2e6c25e02df0043d0164f6e41"
15851559
integrity sha512-I5GTdSfhYfAPNztx2xJRQpG8cuDSNt599/7YUn7Gx/WxNMsG+a835k97TDkFgk123cwjfwINaZknkKkphx/f2A==
15861560

1561+
highlight.js@^11.9.0:
1562+
version "11.9.0"
1563+
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.9.0.tgz#04ab9ee43b52a41a047432c8103e2158a1b8b5b0"
1564+
integrity sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==
1565+
15871566
html-void-elements@^1.0.0:
15881567
version "1.0.5"
15891568
resolved "https://registry.npmjs.org/html-void-elements/-/html-void-elements-1.0.5.tgz#ce9159494e86d95e45795b166c2021c2cfca4483"
@@ -2733,13 +2712,6 @@ prettier@^3.0.3:
27332712
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
27342713
integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==
27352714

2736-
prismjs@^1.22.0:
2737-
version "1.22.0"
2738-
resolved "https://registry.npmjs.org/prismjs/-/prismjs-1.22.0.tgz#73c3400afc58a823dd7eed023f8e1ce9fd8977fa"
2739-
integrity sha512-lLJ/Wt9yy0AiSYBf212kK3mM5L8ycwlyTlSxHBAneXLR0nzFMlZ5y7riFPF3E33zXOF2IH95xdY5jIyZbM9z/w==
2740-
optionalDependencies:
2741-
clipboard "^2.0.0"
2742-
27432715
prop-types@^15.8.1:
27442716
version "15.8.1"
27452717
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
@@ -2977,11 +2949,6 @@ section-matter@^1.0.0:
29772949
extend-shallow "^2.0.1"
29782950
kind-of "^6.0.0"
29792951

2980-
select@^1.1.2:
2981-
version "1.1.2"
2982-
resolved "https://registry.npmjs.org/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d"
2983-
integrity sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=
2984-
29852952
semver@^6.3.0, semver@^6.3.1:
29862953
version "6.3.1"
29872954
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
@@ -3232,11 +3199,6 @@ thenify-all@^1.0.0:
32323199
dependencies:
32333200
any-promise "^1.0.0"
32343201

3235-
tiny-emitter@^2.0.0:
3236-
version "2.1.0"
3237-
resolved "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423"
3238-
integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==
3239-
32403202
to-regex-range@^5.0.1:
32413203
version "5.0.1"
32423204
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"

0 commit comments

Comments
 (0)