Space Script - Using * instead of _ for italics

I changed the Text: Italic command to use * instead of _.

I prefer to use * for both bold and italic text. Both * and _ are part of CommonMark, but _ generally won’t work to italicize part of a word.

silverbullet.registerCommand({
  name: "Text: Italic",
  key: "Ctrl-i"
}, async () => {
  const selection = await syscall("editor.getSelection");
  const from = selection.from;
  const to = selection.to;
  await syscall("editor.dispatch", {
    changes: [
      { from: from, to: from, insert: "*" },
      { from: to, to: to, insert: "*" },
    ],
  });
});
1 Like

Nice one! Obviously _ is the correct way to do italics, but no judgment on your poor taste :wink:

3 Likes