Skip to content
Markdown

Code and Commands

Using code and commands

Basic markdown structure


We can use the basic structure of a code block

Console.WriteLine("Hello World!");
code-block1

Code with a title


We can add a title to our code block to reference a specific file.

Program.cs
public void Main(){
Console.WriteLine("Test");
}
code-block2

Terminal Frame


We can build a structure that resembles a terminal frame to show a specific terminal command.

Checking the version in the Terminal
dotnet --version
code-block3

Adding Labels


We can add extra information to our code to help highlight things

Default highlight

Highlight
// Value input waiting for the user
Console.Write("Enter a value from 0 to 10: ");
string input = Console.ReadLine();
code-block4

Deletion highlight

We can show a specific value that was or should be removed:

Delete
using System;
namespace TestProcess
{
public class Program
{
public static void Main(string[] args)
{
//...
}
}
}
code-block5

Insertion highlight

We can show a specific value that was or should be added:

Add
using System;
namespace TestProcess
{
public class Program
{
public static void Main(string[] args)
{
//...
}
}
}
code-block6

Highlighting a specific word

We can highlight a specific word in the text by placing it in a list.

Defining Gets
using System.ComponentModel.DataAnnotations;
namespace MinimalAPI.Models
{
public class Product
{
public Product() { }
[Key]
public long Id { get; set; }
[StringLength(50)]
[Required]
public required string Name { get; set; }
[Range(0, double.MaxValue)]
[Required]
public double Price { get; set; }
}
}
code-block7