1 | <!DOCTYPE html>
|
2 | <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
3 | <head>
|
4 |
|
5 | <meta charset="utf-8">
|
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
7 |
|
8 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
|
9 |
|
10 | <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
11 |
|
12 |
|
13 | <style>
|
14 |
|
15 | .code-badge {
|
16 | background: #555 !important;
|
17 | padding: 8px !important;
|
18 | }
|
19 | .code-badge-copy-icon {
|
20 | font-size: 1.3em !important;
|
21 | }
|
22 | </style>
|
23 | </head>
|
24 | <body>
|
25 | <div class="container">
|
26 |
|
27 | <h1>HighlightJS Code Copying</h1>
|
28 | <hr>
|
29 |
|
30 | <h3 class="mt-3">Single line code snippet</h3>
|
31 | <pre><code class="hljs language-js">let x = 1;
|
32 | x++;</code></pre>
|
33 |
|
34 |
|
35 | <h3 class="mt-3">Single line code snippet</h3>
|
36 |
|
37 | <pre><code class="hljs lang-js">public static string GetChecksumFromFile(string file)
|
38 | {
|
39 | if (!File.Exists(file))
|
40 | return null;
|
41 |
|
42 | try
|
43 | {
|
44 | byte[] checkSum;
|
45 | using (FileStream stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
46 | {
|
47 | var md = new MD5CryptoServiceProvider();
|
48 | checkSum = md.ComputeHash(stream);
|
49 | }
|
50 |
|
51 | return StringUtils.BinaryToBinHex(checkSum);
|
52 | }
|
53 | catch
|
54 | {
|
55 | return null;
|
56 | }
|
57 | }</code></pre>
|
58 |
|
59 |
|
60 | <h3>Plain Text</h3>
|
61 |
|
62 |
|
63 | <pre><code class="hljs lang-txt">This should be treated as just plain text
|
64 |
|
65 | It shows as is, without any formatting</code></pre>
|
66 |
|
67 |
|
68 |
|
69 | <h3>Auto-Detected</h3>
|
70 | <pre><code>Content-Type: text/html
|
71 | Accept: application/json
|
72 | Content-Length: 12332
|
73 | </code></pre>
|
74 |
|
75 |
|
76 | </div>
|
77 |
|
78 | <link href="highlightJS/styles/vs2015.css" rel="stylesheet">
|
79 | <script src="highlightJs/highlight.pack.js"></script>
|
80 | <script src="highlightjs-badge.js"></script>
|
81 |
|
82 | <script>
|
83 | setTimeout(function () {
|
84 | var pres = document.querySelectorAll("pre>code");
|
85 | for (var i = 0; i < pres.length; i++) {
|
86 | hljs.highlightBlock(pres[i]);
|
87 | }
|
88 | var options = {
|
89 | contentSelector: ".container",
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | loadDelay:0,
|
95 |
|
96 |
|
97 | copyIconClass: "fa fa-copy",
|
98 |
|
99 | checkIconClass: "fa fa-check text-success",
|
100 |
|
101 |
|
102 | onBeforeCodeCopied: function(text) {
|
103 | text = "$$$ " + text;
|
104 | return text;
|
105 | }
|
106 | };
|
107 | window.highlightJsBadge(options);
|
108 | },10);
|
109 | </script>
|
110 |
|
111 |
|
112 | </body>
|
113 | </html>
|