Skip to content

Instantly share code, notes, and snippets.

@redconfetti
Last active August 5, 2021 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redconfetti/7cb148477a82c7c9a3c778e2d34a5e05 to your computer and use it in GitHub Desktop.
Save redconfetti/7cb148477a82c7c9a3c778e2d34a5e05 to your computer and use it in GitHub Desktop.
Markdown Example: HTML + Razor

Markdown Example

This is an example of a Markdown document that provides HTML with Razor syntax included, used in ASP.NET Core.

Example 1

This uses 'cshtml' as the language label.

@if (value % 2 == 0)
{
    <p>The value was even.</p>
}
else if (value >= 1337)
{
    <p>The value is large.</p>
}
else
{
    <p>The value is odd and small.</p>
}

Example 2

This uses 'html+razor' as the language label.

@if (value % 2 == 0)
{
    <p>The value was even.</p>
}

Example 3

This uses 'razor' as the language label.

@{
    var people = new Person[]
    {
          new Person("Weston", 33),
          new Person("Johnathon", 41),
          ...
    };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment