Ident and color VB.Net code

2

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

    
asked by anonymous 10.02.2016 / 15:25

1 answer

5

There is 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, the download page can create a customizable script containing only the languages of your choice .

There are also other colors to highlight the syntax, eg

<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>
    
10.02.2016 / 15:57