本機能はGitHub repo本文(READMEなど)では機能しないことに注意。効果はこの本文の下にあるコメント欄を見ると確認できる。
GitHubのComments/Issues/Pull requestsではコードスパンの中にCSSの色表現を記述するとカラーサンプル付きで表示する。
ただし全ての表現が使えるのではなく、使える書式とそうでないものがある。確認コードは次の通り。
| 表現 | 文例 | 判定 |
// JavaScript Array permutation generator | |
// (optimized from CoffeeScript output: see ArrayPermutation.coffee) | |
(function() { | |
var generatePermutation = function(perm, pre, post, n) { | |
var elem, i, rest, len; | |
if (n > 0) | |
for (i = 0, len = post.length; i < len; ++i) { | |
rest = post.slice(0); | |
elem = rest.splice(i, 1); | |
generatePermutation(perm, pre.concat(elem), rest, n - 1); |
# Render markdown-escapes.md | |
N_COL = 16 | |
puts "# Backslash escapes in Markdown" | |
puts | |
puts "Backslash escape effects for all ASCII printable characters (→ [source](https://gist.github.com/higuma/15de141310855a8f654792046dca5c50))" | |
puts | |
puts "| U+ |" + (0...N_COL).inject('') {|row, col| row + sprintf(" %X |", col) } | |
puts (0..N_COL).inject('|') {|row, _| row + ' :-: |' } |
Backslash escape effects for all ASCII printable characters (→ source)
U+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0020 | \ \ |
\! ! |
\" " |
\# # |
\$ $ |
\% % |
\& & |
\' ' |
\( ( |
\) ) |
\* * |
\+ + |
\, , |
\- - |
\. . |
\/ / |
0030 | \0 ⁠\0 |
\1 ⁠\1 |
\2 ⁠\2 |
\3 ⁠\3 |
\4 ⁠\4 |
\5 ⁠\5 |
\6 ⁠\6 |
\7 ⁠\7 |
\8 ⁠\8 |
\9 & |
(2022-08-11現在) 次のMarkdown文書はPreviewとOutputで結果が異なる。
\[これはリンクではない、しかしリンク先に注意](https\://www\.example\.com)
[これはリンクではない、しかしリンク先に注意](https://www.example.com)
https://...
の部分は次のように処理される。
#!/usr/bin/env ruby | |
# Recursive line/word/byte counter | |
require 'find' | |
require 'fileutils' | |
ARGV.push '.' if ARGV.empty? | |
total_lines = total_words = total_bytes = 0 |
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'webrick' | |
# Add additional MIME types here | |
WEBrick::Config::HTTP[:MimeTypes].update({ | |
'wasm' => 'application/wasm' | |
}) |
#!/usr/bin/env ruby | |
# git-id: calculates the git ID (sha-1) with the specified object type | |
require 'optparse' | |
require 'openssl' | |
type = 'blob' # as default | |
opt = OptionParser.new |
// MNIST database reader | |
// http://yann.lecun.com/exdb/mnist/ | |
package mnist | |
import ( | |
"fmt" | |
"os" | |
"path/filepath" | |
) |