X# Syntax Highlighting in Html Files with HighlightJS

This forum is meant for anything you would like to share with other visitors
Post Reply
VR
Posts: 102
Joined: Sun Aug 23, 2020 3:07 pm
Location: Italy

X# Syntax Highlighting in Html Files with HighlightJS

Post by VR »

Our summer intern was busy and released another syntax highlighting related plugin, this time for the JS library HighlightJS. It can be used in the following way:

Code: Select all

<head>
    <link rel=stylesheet href="https://cdn.jsdelivr.net/npm/highlight.js@11.1.0/styles/vs.css" />
    <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.1.0/build/highlight.min.js" ></script>
    <script src="https://cdn.jsdelivr.net/npm/highlightjs-xsharp@0.0.1/dist/xsharp.min.js" ></script>
    <script>hljs.highlightAll()</script>
</head>
<body>
    <pre><code class="language-xsharp">
using system.Xml.Linq // needs references to System.XML and System.Xml.Linq in Project

class XDocumentExportExamples

method StaticXmlDoc() as void strict
    var doc := XDocument{;
    XElement{"info", ;
        XElement{"version", XAttribute{"id", 123}}, ;
        XElement{"changelog", "dummy dummy"}}}
    Console:WriteLine(doc:ToString())
    return
    </code></pre>
</body>    
When this Html Code is shown in a Browser, it looks like this:

Image
Post Reply