Identar and colorize VB.Net code

Asked

Viewed 103 times

2

Is there any JS or/and CSS that is able to indent and color VB.net code inside a div or input?

1 answer

5


There is the Highlight, a Javascript library:

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.1.0/styles/default.min.css">

<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.1.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

<pre><code class='vbnet'>
Imports System

Public Class Example
    Private Shared Function EndsWithS(ByVal s As String) As Boolean
        If (s.Length > 5) AndAlso (s.Substring(s.Length - 6).ToLower() = "S") Then
            Return True
        Else
            Return False
        End If
    End Function
End Class
</code></pre>

If you only want to support Vb.NET, on the download it is possible to create a customizable script containing only the languages of your choice.

There are also other colors to highlight the syntax, example:

<link rel="stylesheet" href="https://highlightjs.org/static/demo/styles/zenburn.css">

<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.1.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

<pre><code class='vb'>
Imports System

Public Class Example
    Private Shared Function EndsWithS(ByVal s As String) As Boolean
        If (s.Length > 5) AndAlso (s.Substring(s.Length - 6).ToLower() = "S") Then
            Return True
        Else
            Return False
        End If
    End Function
End Class
</code></pre>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.