Skip to content

Commit 7b7d86b

Browse files
committed
feat: 为行内代码块新增更明显的样式区别
1 parent 0e18110 commit 7b7d86b

2 files changed

Lines changed: 46 additions & 8 deletions

File tree

src/core/schema/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ const code_inline: MarkSpec = {
525525
inclusive: false, // 新输入的文本不自动继承此 mark
526526
parseDOM: [{ tag: "code" }],
527527
toDOM(): DOMOutputSpec {
528-
return ["code", 0];
528+
return ["code", { class: "milkup-code-inline" }, 0];
529529
},
530530
};
531531

src/core/styles/milkup.css

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,51 @@
6060
}
6161

6262
/* 行内代码 */
63-
.milkup-code-inline {
64-
background: var(--background-color-2, #f5f5f5);
65-
color: var(--primary-color, #e83e8c);
66-
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
67-
font-size: 0.9em;
68-
padding: 0.2em 0.4em;
69-
border-radius: 3px;
63+
.milkup-code-inline,
64+
.milkup-editor code {
65+
display: inline-block;
66+
vertical-align: baseline;
67+
background: linear-gradient(
68+
180deg,
69+
var(--background-color-3, #eaecef) 0%,
70+
var(--hover-background-color, rgba(94, 129, 172, 0.1)) 100%
71+
);
72+
color: var(--text-color-1, #333);
73+
font-family: var(--milkup-font-code), 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo,
74+
monospace;
75+
font-size: calc(var(--milkup-font-size-code, 16px) * 0.875);
76+
font-weight: 600;
77+
line-height: 1.2;
78+
padding: 0.16em 0.5em;
79+
margin: 0 0.08em;
80+
border: 1px solid var(--border-color-1, #d1d5da);
81+
border-radius: 6px;
82+
box-shadow:
83+
inset 0 1px 0 rgba(255, 255, 255, 0.08),
84+
0 1px 2px rgba(0, 0, 0, 0.08);
85+
word-break: break-word;
86+
}
87+
88+
.milkup-syntax .milkup-code-inline,
89+
.milkup-syntax-visible .milkup-code-inline,
90+
.milkup-syntax-marker .milkup-code-inline,
91+
.milkup-editor code.milkup-syntax,
92+
.milkup-editor code.milkup-syntax-visible,
93+
.milkup-editor code.milkup-syntax-marker {
94+
display: inline;
95+
vertical-align: baseline;
96+
background: transparent;
97+
color: inherit;
98+
font-family: inherit;
99+
font-size: inherit;
100+
font-weight: inherit;
101+
line-height: inherit;
102+
padding: 0;
103+
margin: 0;
104+
border: none;
105+
border-radius: 0;
106+
box-shadow: none;
107+
word-break: normal;
70108
}
71109

72110
/* 删除线 */

0 commit comments

Comments
 (0)