Syntax highlighting for the Web
JavaScript:
The bare minimum for using highlight.js on a web page is linking to the library along with one of the styles and calling [B]initHighlightingOnLoad[/B]:
[CODE=javascript]
<!-- <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/default.min.css"> -->
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/railscasts.min.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<style>
code {font-size: 1.2em;}
</style>
<body>
<code>
private void fill_x()
{
try
{
x.DataSource = null;
DataTable dT = General.Conne.GetDATATABLE("select x,y from x_table order by x,y");
DataRow dR = dT.NewRow();
dR[0] = 0;
dR[1] = "";
dT.Rows.InsertAt(dR, 0);
txtX_ID.DataSource = dT;
txtX_ID.DisplayMember = "x_name";
txtX_ID.ValueMember = "rec_id";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "x", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
</code>
</pre>
</body>