is an open source project for JavaScript based code highlighting. Visit the Highlightjs.org site to get detailed information about usage, configuration and new releases!
Installation and Basic Usage
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/languages/powershell.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/languages/vbscript-html.min.js"></script>
Here is the basic init function:
<script>hljs.initHighlightingOnLoad();</script>
Now you can highlight your code, putting it inside of <pre>, <code> html tags by providing a class value (<code class="html or xml or c# or ...">), for your programming language. A list of supported programming/markup languages can be found here Class reference.<pre><code class="html">
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
</code></pre>
Now you can highlight your code by setting the respective class value i.e. xml, html, ps, js, c#...If you want to highlight HTML, encode it first --> Html EncoderAvailable Themes
HTML Escape your html upfront!
<meta name="CG" content="Homepage" />
<meta name="SCG" content="" />
<meta name="PT" content="Homepage" />
<meta name="PST" content="" />
<meta name="application-name" content="The New York Times" />
<meta name="msapplication-starturl" content="http://www.nytimes.com" />
<meta name="msapplication-task" content="name=Search;action-uri=http://css.nyt.com/images/icons/search.ico" />
<meta name="msapplication-task" content="name=Most Popular;action-uri=http://www.nytimes.com/gst.html?src=iepin;" />
<meta name="msapplication-task" content="name=Video;action-uri=http://css.nyt.com/icons/video.ico" />
<meta name="msapplication-task" content="name=Homepage;action-uri=icon-uri=http://css.nyt.com/icons/homepage.ico" />
<meta property="og:url" content="http://www.nytimes.com" />
CSHARP/C# using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Company.BU.Project
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
svc.SharepointEmailWS sv = new svc.SharepointEmailWS();
var status = sv.CreateContact("Bosch", svc.ContactFlags.None);
}
}
}JavaScript $.fn.printEvents = function () {
console.log("************ Event Logging START ************");
var d = jQuery._data(this[0], "events");
if (d == undefined) {
console.log(">> No Events found!"); return this;
}
var count = Object.keys(d).length;
for (var i = 0; i < count; i++) {
var name = Object.keys(d)[i];
var obj = d[name];
var cnt = obj.length;
for (var x = 0; x < cnt; x++) {
var o = obj[x];
console.log(" ");
console.log("************ " + o.origType + " event ************");
console.log("OrigType: " + o.origType);
console.log("Type: " + o.type);
console.log("Handler: " + o.handler);
console.log("Guid: " + o.guid);
console.log("Data: " + o.data);
console.log("Selector: " + o.selector);
console.log("Namespace: " + o.namespace + "\n\r");
}
}
console.log("************ Event Logging END ************");
};PowerShell Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version -EA 0 |
Where { $_.PSChildName -match '^(?!S)\p{L}'} |
Select PSChildName, Version
Technorati Tags: JavaScript,Highlight.js
No comments :
Post a Comment