This post demonstrate the use of code snippets in the theme. This is a raw snippet:
hello world
123
This is a text snippet
This is a PHP snippet:
<?php
echo 'Hello, World!';
?>
This is test code
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
new HostBuilder()
.ConfigureAppConfiguration((context, config) =>
{
config
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables();
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder
.UseStartup<Startup>()
.UseUrls($"http://*:5000/");
});
}
This is a JavaScript snippet:
const add = (a, b) => a + b
const minus = (a, b) => a - b
console.log(add(100,200)) // 300
console.log(minus(100,200)) // -100
This is a Python snippet:
def say_hello():
print("hello world!")
say_hello() // "hello world!"