Skip to content

Commit

Permalink
style: 编辑区增加对yaml语法的高亮展示
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsonliu committed Oct 29, 2024
1 parent ef7a946 commit 08c220d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import codemirror from 'codemirror';
// import 'codemirror/mode/markdown/markdown';
import 'codemirror/mode/gfm/gfm'; // https://codemirror.net/mode/gfm/index.html
import 'codemirror/mode/yaml-frontmatter/yaml-frontmatter'; // https://codemirror.net/5/mode/yaml-frontmatter/index.html
// import 'codemirror/mode/xml/xml';
import 'codemirror/addon/edit/continuelist';
import 'codemirror/addon/edit/closetag';
Expand Down Expand Up @@ -78,7 +79,7 @@ export default class Editor {
// matchBrackets: true, // 括号匹配
// mode: 'gfm', // 从markdown模式改成gfm模式,以使用默认高亮规则
mode: {
name: 'gfm',
name: 'yaml-frontmatter', // yaml-frontmatter在gfm的基础上增加了对yaml的支持
gitHubSpice: false,
},
lineWrapping: true, // 自动换行
Expand Down
2 changes: 1 addition & 1 deletion src/sass/themes/blue.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ $mdBlockquoteBg: $VIOLET1;
span, .cm-variable-2, .cm-string, .cm-strong, .cm-em, .cm-meta {
color: $editorColor;
}
.cm-image-marker, .cm-quote, .cm-header {
.cm-image-marker, .cm-quote, .cm-header, .cm-atom {
color: $editorImportantColor;
}
.cm-url {
Expand Down
2 changes: 1 addition & 1 deletion src/sass/themes/dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ $mdSvgTextColor: rgb(250, 160, 0);
span, .cm-variable-2, .cm-string, .cm-strong, .cm-em, .cm-meta {
color: $editorColor;
}
.cm-image-marker, .cm-quote, .cm-header {
.cm-image-marker, .cm-quote, .cm-header, .cm-atom {
color: $editorImportantColor;
}
.cm-url {
Expand Down
2 changes: 1 addition & 1 deletion src/sass/themes/green.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ $mdBlockquoteBg: $GREEN1;
span, .cm-variable-2, .cm-string, .cm-strong, .cm-em, .cm-meta {
color: $editorColor;
}
.cm-image-marker, .cm-quote, .cm-header {
.cm-image-marker, .cm-quote, .cm-header, .cm-atom {
color: $editorImportantColor;
}
.cm-url {
Expand Down
2 changes: 1 addition & 1 deletion src/sass/themes/light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ $mdBlockquoteBg: rgb(231, 245, 255);
span, .cm-variable-2, .cm-string, .cm-strong, .cm-em, .cm-meta {
color: $editorColor;
}
.cm-image-marker, .cm-quote, .cm-header {
.cm-image-marker, .cm-quote, .cm-header, .cm-atom {
color: $editorImportantColor;
}
.cm-url {
Expand Down
2 changes: 1 addition & 1 deletion src/sass/themes/red.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ $mdBlockquoteBg: $PINK1;
span, .cm-variable-2, .cm-string, .cm-strong, .cm-em, .cm-meta {
color: $editorColor;
}
.cm-image-marker, .cm-quote, .cm-header {
.cm-image-marker, .cm-quote, .cm-header, .cm-atom {
color: $editorImportantColor;
}
.cm-url {
Expand Down
2 changes: 1 addition & 1 deletion src/sass/themes/violet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ $mdBlockquoteBg: $VIOLET1;
span, .cm-variable-2, .cm-string, .cm-strong, .cm-em, .cm-meta {
color: $editorColor;
}
.cm-image-marker, .cm-quote, .cm-header {
.cm-image-marker, .cm-quote, .cm-header, .cm-atom {
color: $editorImportantColor;
}
.cm-url {
Expand Down

0 comments on commit 08c220d

Please sign in to comment.