Skip to content

Commit 8474a34

Browse files
author
ws-wangjg
committed
feat: pro mdx editor
1 parent e821907 commit 8474a34

1 file changed

Lines changed: 159 additions & 0 deletions

File tree

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
.ProseMirror {
2+
pre {
3+
background: #1e293b;
4+
color: #e2e8f0;
5+
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
6+
padding: 1rem 1.25rem;
7+
border-radius: 8px;
8+
font-size: 14px;
9+
line-height: 1.6;
10+
overflow-x: auto;
11+
margin: 1rem 0;
12+
position: relative;
13+
14+
code {
15+
background: none;
16+
color: inherit;
17+
padding: 0;
18+
font-size: inherit;
19+
border-radius: 0;
20+
}
21+
}
22+
}
23+
24+
// Lowlight / highlight.js 语法高亮主题
25+
.hljs-comment,
26+
.hljs-quote {
27+
color: #6b7280;
28+
font-style: italic;
29+
}
30+
31+
.hljs-doctag,
32+
.hljs-keyword,
33+
.hljs-formula {
34+
color: #c678dd;
35+
}
36+
37+
.hljs-section,
38+
.hljs-name,
39+
.hljs-selector-tag,
40+
.hljs-deletion,
41+
.hljs-subst {
42+
color: #e06c75;
43+
}
44+
45+
.hljs-literal {
46+
color: #56b6c2;
47+
}
48+
49+
.hljs-string,
50+
.hljs-regexp,
51+
.hljs-addition,
52+
.hljs-attribute,
53+
.hljs-meta .hljs-string {
54+
color: #98c379;
55+
}
56+
57+
.hljs-attr,
58+
.hljs-variable,
59+
.hljs-template-variable,
60+
.hljs-type,
61+
.hljs-selector-class,
62+
.hljs-selector-attr,
63+
.hljs-selector-pseudo,
64+
.hljs-number {
65+
color: #d19a66;
66+
}
67+
68+
.hljs-symbol,
69+
.hljs-bullet,
70+
.hljs-link,
71+
.hljs-meta,
72+
.hljs-selector-id,
73+
.hljs-title {
74+
color: #61aeee;
75+
}
76+
77+
.hljs-built_in,
78+
.hljs-title.class_,
79+
.hljs-class .hljs-title {
80+
color: #e6c07b;
81+
}
82+
83+
.hljs-emphasis {
84+
font-style: italic;
85+
}
86+
87+
.hljs-strong {
88+
font-weight: bold;
89+
}
90+
91+
.hljs-link {
92+
text-decoration: underline;
93+
}
94+
95+
// 代码块语言标签 (可选)
96+
.ProseMirror pre::before {
97+
content: attr(data-language);
98+
position: absolute;
99+
top: 0;
100+
right: 0;
101+
padding: 4px 10px;
102+
font-size: 11px;
103+
color: #94a3b8;
104+
background: rgba(0, 0, 0, 0.2);
105+
border-radius: 0 8px 0 6px;
106+
text-transform: uppercase;
107+
letter-spacing: 0.5px;
108+
font-family: inherit;
109+
}
110+
111+
// 浅色主题适配
112+
[data-theme='light'] .ProseMirror pre,
113+
.mdxApp:not(.themeDark) .ProseMirror pre {
114+
background: #f8fafc;
115+
border: 1px solid #e2e8f0;
116+
117+
code {
118+
color: #1e293b;
119+
}
120+
}
121+
122+
[data-theme='light'],
123+
.mdxApp:not(.themeDark) {
124+
.hljs-comment,
125+
.hljs-quote {
126+
color: #6b7280;
127+
}
128+
129+
.hljs-keyword,
130+
.hljs-doctag {
131+
color: #8b5cf6;
132+
}
133+
134+
.hljs-string,
135+
.hljs-regexp,
136+
.hljs-addition {
137+
color: #059669;
138+
}
139+
140+
.hljs-number,
141+
.hljs-attr {
142+
color: #d97706;
143+
}
144+
145+
.hljs-title,
146+
.hljs-section {
147+
color: #2563eb;
148+
}
149+
150+
.hljs-name,
151+
.hljs-selector-tag {
152+
color: #dc2626;
153+
}
154+
155+
.hljs-built_in,
156+
.hljs-title.class_ {
157+
color: #ca8a04;
158+
}
159+
}

0 commit comments

Comments
 (0)