Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 667a754

Browse files
authored
Use * for italics as it doesn't break when used mid-word (#12523)
* Use `*` for italics as it doesn't break when used mid-word Signed-off-by: Michael Telatynski <[email protected]> * Fix tests Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent 77a7245 commit 667a754

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/editor/operations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function formatRange(range: Range, action: Formatting): void {
4848
toggleInlineFormat(range, "**");
4949
break;
5050
case Formatting.Italics:
51-
toggleInlineFormat(range, "_");
51+
toggleInlineFormat(range, "*");
5252
break;
5353
case Formatting.Strikethrough:
5454
toggleInlineFormat(range, "<del>", "</del>");

test/editor/operations-test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe("editor/operations: formatting operations", () => {
101101
expect(range.parts[0].text).toBe("world");
102102
expect(model.serializeParts()).toEqual([{ text: "hello world!", type: "plain" }]);
103103
formatRange(range, Formatting.Italics);
104-
expect(model.serializeParts()).toEqual([{ text: "hello _world_!", type: "plain" }]);
104+
expect(model.serializeParts()).toEqual([{ text: "hello *world*!", type: "plain" }]);
105105
});
106106

107107
describe("escape backticks", () => {
@@ -204,9 +204,9 @@ describe("editor/operations: formatting operations", () => {
204204
]);
205205
formatRange(range, Formatting.Italics);
206206
expect(model.serializeParts()).toEqual([
207-
{ text: "hello _there ", type: "plain" },
207+
{ text: "hello *there ", type: "plain" },
208208
{ text: "@room", type: "at-room-pill" },
209-
{ text: ", how are you_ doing?", type: "plain" },
209+
{ text: ", how are you* doing?", type: "plain" },
210210
]);
211211
});
212212

@@ -377,7 +377,7 @@ describe("editor/operations: formatting operations", () => {
377377

378378
// We expect formatting to still happen in the first line as the caret should not jump down
379379
expect(model.serializeParts()).toEqual([
380-
{ text: "hello _hello!_", type: "plain" },
380+
{ text: "hello *hello!*", type: "plain" },
381381
SERIALIZED_NEWLINE,
382382
{ text: "world", type: "plain" },
383383
]);

0 commit comments

Comments
 (0)