I recently saw, that the Loop Web now supports “code” Components.
Just type “/” and select “</> Code”.
There are a variety of Programming Languages supported for Syntax Highlighting
I just used an old PowerShell Script
The “code” Component is also supported by the Loop App from the Microsoft Store
You can copy the Link from the Loop app, and paste it into Teams.
Nor Teams, Outlook or Word Online natively supports the “code” component
The biggest issue of Microsoft Loop still is, that you can’t share it outside of your Tenant.