3

Syntax highlighting for both Powershell and Batch works if specified manually in an HTML comment, but not via a code block:

  • Doesn't Work: (code block)
    • ```bat
      
    • ```powershell
      

  • Works: (HTML comment)
    • <!-- language-all: lang-bat -->
      <!-- language: lang-bat -->
    • <!-- language-all: lang-powershell -->
      <!-- language: lang-powershell -->

Why is there this disparity?

  • I'm not familiar with how StackExchange sites individually function, but wouldn't it be a lot simpler and efficient, causing less discombobulation, if shell languages were supported the same across all sites supporting code block markdown?

    For example, syntax highlighting for both Powershell and Batch are auto-applied on StackOverflow.
| |
4

Why is there a disparity between code fences and HTML comments used to set language?

Reproduced and fixed.

The issue was that the "Code Language (used for syntax highlighting)" in the tag descriptions was set to "none".

Changing that to "default" in and fixed the issue:

enter image description here

Note that the list of languages available do not include options that are more suited to or so I took a guess and used "default".

Here is my test question (which I'm going to delete)

Source:

testing common mark for batch files and powershell

```batch
echo Hello World!
```

```powershell
Write-Host "Hello World"
```

<!-- language: lang-bat -->
    echo Hello World!


<!-- language: lang-powershell -->
    Write-Host "Hello World"

Rendered:

enter image description here

| |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .