Skip to main content
added 38 characters in body
Source Link
OhBeWise
  • 5.5k
  • 10
  • 16

For large code blocks, nhahtdh's answer works perfectly. For single lines of code, I use this trick:

  • Start and end the line of code with the backtick (grave accent `), just as you would an in-line block of code: `string example = "Like this..." `
  • Then highlight that line and hit Ctrl+K as usual.

This example shows that both solutions line up correctly:

  1. List item

    bool truth = true; // Using grave accents.

    bool lies = false; // Using 8 space indentation.
    if (truth == lies)
    {
        Console.WriteLine("Congrats on your election!");
    }
    
  2. List item

For large code blocks, nhahtdh's answer works perfectly. For single lines of code, I use this trick:

  • Start and end the line of code with the backtick (grave accent `), just as you would an in-line block of code.
  • Then highlight that line and hit Ctrl+K as usual.

This example shows that both solutions line up correctly:

  1. List item

    bool truth = true; // Using grave accents.

    bool lies = false; // Using 8 space indentation.
    if (truth == lies)
    {
        Console.WriteLine("Congrats on your election!");
    }
    
  2. List item

For large code blocks, nhahtdh's answer works perfectly. For single lines of code, I use this trick:

  • Start and end the line of code with the backtick (grave accent `), just as you would an in-line block of code: `string example = "Like this..." `
  • Then highlight that line and hit Ctrl+K as usual.

This example shows that both solutions line up correctly:

  1. List item

    bool truth = true; // Using grave accents.

    bool lies = false; // Using 8 space indentation.
    if (truth == lies)
    {
        Console.WriteLine("Congrats on your election!");
    }
    
  2. List item

Source Link
OhBeWise
  • 5.5k
  • 10
  • 16

For large code blocks, nhahtdh's answer works perfectly. For single lines of code, I use this trick:

  • Start and end the line of code with the backtick (grave accent `), just as you would an in-line block of code.
  • Then highlight that line and hit Ctrl+K as usual.

This example shows that both solutions line up correctly:

  1. List item

    bool truth = true; // Using grave accents.

    bool lies = false; // Using 8 space indentation.
    if (truth == lies)
    {
        Console.WriteLine("Congrats on your election!");
    }
    
  2. List item