C#
C#
/*lang=c#*/ """string Author() => "meziantou";""";
It also works in xml doc comments (#80672):
C#
/// <summary>
/// <code lang="C#">public void Sample() { }</code>
/// </summary>
C#-test: for testing Roslyn Analyzers
C#
/*lang=c#-test*/ """string Author() => [|"meziantou"|];""";
Regex
C#
/*lang=regex*/ "[a-z]+";
/*lang=regexp*/ "[a-z]+";
JSON: You can specify json options if needed. Available options are: AllowComment, TrailingCommas, Strict (source). If the json is not valid, Roslyn emits a warning.
C#
/*lang=json*/ """{ "author": "meziantou", }"""; // Allow comment and trailing commas
/*lang=json,strict*/ """{ "author": "meziantou" }""";
/*lang=json,AllowComment,TrailingCommas*/ """{ "author": "meziantou", } // comment""";
/*lang=json,strict*/ """{ "author": "meziantou", }"""; // warning JSON0001
DateTime formats:
C#
/*lang=datetime*/ "yyyy-MM-dd HH:mm:ss"; // Provide auto-completion for datetime format
/*lang=time*/ "HH:mm:ss"; // Provide auto-completion for time format
/*lang=date*/ "yyyy-MM-dd"; // Provide auto-completion for date format
/*lang=datetimeformat*/ "yyyy-MM-dd"; // Provide auto-completion for date format
XML
C#
/*lang=xml*/ """<author>meziantou</author>""";
ASP.NET Core routes. Only works in ASP.NET Context (require Microsoft.NET.Sdk.Web sdk)
C#
/*lang=Route*/ """author/{id}"""; // Provide highlighting for route parameters