Does Syntax highlighting only work on fenced code blocks but not indented code blocks?

Does Syntax highlighting only work on fenced code blocks but not indented code blocks?

Fenced Code Block

// A Hello World! program in C#.
using System;
namespace HelloWorld
{
    class Hello 
    {
        static void Main() 
        {
            Console.WriteLine("Hello World!");

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }
}

Indented Code Block

// A Hello World! program in C#.
using System;
namespace HelloWorld
{
    class Hello 
    {
        static void Main() 
        {
            Console.WriteLine("Hello World!");

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }
}

It can work for both, depending on settings. Here on meta default code lang is text and autohighlight all code is false, so indented code is never highlighted and fenced code only when a language is specified.

// A Hello World! program in C#.
using System;
namespace HelloWorld
{
    class Hello 
    {
        static void Main() 
        {
            Console.WriteLine("Hello World!");

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }
}
4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.