1 | <!DOCTYPE html>
|
2 | <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
3 | <head>
|
4 | <meta charset="utf-8">
|
5 | <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6 |
|
7 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
8 |
|
9 | <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
10 |
|
11 |
|
12 | <style>
|
13 |
|
14 | .code-badge {
|
15 | background: #555 !important;
|
16 | padding: 8px !important;
|
17 | }
|
18 | .code-badge-copy-icon {
|
19 | font-size: 1.3em !important;
|
20 | }
|
21 | .hide-on-load {
|
22 | display: none;
|
23 | }
|
24 | </style>
|
25 |
|
26 |
|
27 | <link href="https://rickstrahl.github.io/highlightjs-badge/highlightjs/styles/vs2015.css" rel="stylesheet">
|
28 | <script src="https://rickstrahl.github.io/highlightjs-badge/highlightjs/highlight.pack.js"></script>
|
29 |
|
30 | </head>
|
31 | <body class="hide-on-load">
|
32 | <div class="container">
|
33 |
|
34 | <h1>HighlightJS Code Copying</h1>
|
35 | <hr>
|
36 |
|
37 | <h3 class="mt-3">Single line code snippet</h3>
|
38 | <pre><code class="hljs language-js">let x = 1;
|
39 | x++;</code></pre>
|
40 |
|
41 |
|
42 | <h3 class="mt-3">Single line code snippet</h3>
|
43 |
|
44 | <pre><code class="hljs language-cs">public static string GetChecksumFromFile(string file)
|
45 | {
|
46 | if (!File.Exists(file))
|
47 | return null;
|
48 |
|
49 | try
|
50 | {
|
51 | byte[] checkSum;
|
52 | using (FileStream stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
53 | {
|
54 | var md = new MD5CryptoServiceProvider();
|
55 | checkSum = md.ComputeHash(stream);
|
56 | }
|
57 |
|
58 | return StringUtils.BinaryToBinHex(checkSum);
|
59 | }
|
60 | catch
|
61 | {
|
62 | return null;
|
63 | }
|
64 | }</code></pre>
|
65 |
|
66 |
|
67 | <h3>Auto-Detected</h3>
|
68 | <pre><code>Content-Type: text/html
|
69 | Accept: application/json
|
70 | Content-Length: 12332
|
71 | </code></pre>
|
72 |
|
73 |
|
74 | </div>
|
75 |
|
76 | <script src="https://rickstrahl.github.io/highlightjs-badge/highlightjs-badge.js"></script>
|
77 |
|
78 |
|
79 | <script>
|
80 | setTimeout(function () {
|
81 | var pres = document.querySelectorAll("pre>code");
|
82 | for (var i = 0; i < pres.length; i++) {
|
83 | hljs.highlightBlock(pres[i]);
|
84 | }
|
85 | var options = {
|
86 | contentSelector: "#ArticleBody",
|
87 |
|
88 |
|
89 |
|
90 |
|
91 | loadDelay:0,
|
92 |
|
93 |
|
94 | copyIconClass: "fa fa-copy",
|
95 |
|
96 | checkIconClass: "fa fa-check text-success"
|
97 | };
|
98 | window.highlightJsBadge(options);
|
99 | },10);
|
100 | </script>
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 | <script>
|
163 | if (typeof Object.assign !== 'function') {
|
164 |
|
165 | Object.defineProperty(Object, "assign", {
|
166 | value: function assign(target, varArgs) {
|
167 | 'use strict';
|
168 | if (target === null || target === undefined) {
|
169 | throw new TypeError('Cannot convert undefined or null to object');
|
170 | }
|
171 |
|
172 | var to = Object(target);
|
173 |
|
174 | for (var index = 1; index < arguments.length; index++) {
|
175 | var nextSource = arguments[index];
|
176 |
|
177 | if (nextSource !== null && nextSource !== undefined) {
|
178 | for (var nextKey in nextSource) {
|
179 |
|
180 | if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
181 | to[nextKey] = nextSource[nextKey];
|
182 | }
|
183 | }
|
184 | }
|
185 | }
|
186 | return to;
|
187 | },
|
188 | writable: true,
|
189 | configurable: true
|
190 | });
|
191 | }
|
192 |
|
193 | if (!String.prototype.trim) {
|
194 | String.prototype.trim = function () {
|
195 | return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
196 | };
|
197 | }
|
198 |
|
199 | setTimeout(function() {
|
200 | document.body.classList.remove('hide-on-load');
|
201 | },90);
|
202 | </script>
|
203 |
|
204 | </body>
|
205 | </html>
|