···2525 const enterHandler = (view: view.EditorView) => {
2626 const { state } = view;
2727 const { from } = state.selection.main;
2828- const line = state.doc.lineAt(from).text;
2828+ const line = state.doc.lineAt(from);
29293030- // Get the current indentation
3131- const currentIndent = line.match(/^(\s*)/)?.[0] ?? "";
3232- const unit = state.facet(language.indentUnit);
3030+ const change = line.text.substring(0, from - line.from).trim() !== "";
33313432 let result = "\n";
35333434+ // Get the current indentation
3535+ const currentIndent = line.text.match(/^(\s*)/)?.[0] ?? "";
3636+ const unit = state.facet(language.indentUnit);
3737+3638 // Check if line ends with a colon
3737- if (/:\s*(?:#.*)?$/.test(line)) {
3939+ if (change && /:\s*(?:#.*)?$/.test(line.text)) {
3840 result += currentIndent + unit; // Increase indent for new line
3941 }
40424143 // Check if line starts starts with a dash
4242- else if (/^\s*-/.test(line)) {
4444+ else if (change && /^\s*-/.test(line.text)) {
4345 result += currentIndent + "- "; // Inset a dash on new line
4446 }
4547···212214213215 // padding: 0 10px;
214216 border-radius: 5px;
215215- overflow: hidden;
216217217218 border: 1px solid var(--subtext0);
218219