{"id":45677,"date":"2024-01-18T09:52:07","date_gmt":"2023-01-16T00:36:59","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/"},"modified":"2024-05-04T18:54:38","modified_gmt":"2024-05-04T10:54:38","slug":"45677-2","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/","title":{"rendered":""},"content":{"rendered":"<p>\u6700\u8fd1\u5c11\u3057\u8abf\u3079\u3066\u3044\u305f\u3001Source-highlight \u306b\u3064\u3044\u3066\u307e\u3068\u3081\u307e\u3057\u305f\u3002<br \/>\nless \u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4\u30c8\u3067\u304a\u99b4\u67d3\u307f\u306e\u30c4\u30fc\u30eb\u3067\u3059\u304c\u3001\u8abf\u3079\u3066\u307f\u308b\u3068\u306a\u304b\u306a\u304b\u6c4e\u7528\u6027\u306e\u3042\u308b\u9762\u767d\u3044\u8a2d\u8a08\u3067\u3001\u305d\u308c\u3060\u3051\u306e\u30c4\u30fc\u30eb\u3068\u3057\u3066\u6e08\u307e\u305b\u308b\u3068\u3044\u3046\u306e\u306f\u4f59\u308a\u306b\u3082\u3063\u305f\u3044\u306a\u3044\u3068\u601d\u3044\u7b46\u3092\u3068\u308a\u307e\u3057\u305f\u3002<br \/>\n\u7279\u306b\u65b0\u3057\u3044\u8a71\u984c\u3067\u3082\u306a\u3044\u3067\u3059\u304c\u3001\u300c\u67af\u308c\u305f\u6280\u8853\u306f\u795e\u300d\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3053\u306e\u8a18\u4e8b\u3092\u901a\u3057\u3066\u63a8\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>Source-highlight \u3068\u306f\uff1f<\/h2>\n<p>GNU \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4e00\u90e8\u3067\u3001\u6b63\u5f0f\u540d\u79f0\u306f GNU Source-highlight\u3002<br \/>\nLorenzo Bettini \u6c0f\u306b\u3088\u3063\u3066\u958b\u767a\u3055\u308c\u305f\u30c4\u30fc\u30eb\u3067\u30012001 \u5e74\u3088\u308a\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306f 3.1.8 \u3067\u3001\u73fe\u5728\u3082\u7d99\u7d9a\u3057\u3066\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u306a\u304a\u3001\u672c\u7a3f\u306f\u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u5143\u306b\u57f7\u7b46\u3057\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>Source-highlight \u306f\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u975e\u4f9d\u5b58\u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4\u30c8\u30c4\u30fc\u30eb\u3067\u3059\u3002<br \/>\n\u5165\u529b\u3068\u3057\u3066\u53d7\u3051\u53d6\u3063\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3084\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u3001\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4\u30c8\u3092\u65bd\u3057\u3066\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e3b\u8981\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306f\u3082\u3061\u308d\u3093\u306e\u3053\u3068\u3001CoffeeScript \u3084 Go \u3068\u3044\u3063\u305f\u65b0\u3057\u76ee\u306e\u8a00\u8a9e\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001HTML, CSS \u3068\u3044\u3063\u305f\u30de\u30fc\u30af\u30a2\u30c3\u30d7\u8a00\u8a9e\u306e\u4ed6\u306b\u3001JSON, XML, ini \u3068\u3044\u3063\u305f\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u51fa\u529b\u5f62\u5f0f\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306f HTML \u3067\u3059\u304c\u3001LATEX \u3084 MediaWiki \u306a\u3069\u5225\u306e\u5f62\u5f0f\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4e3b\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u3067\u306f\u30ab\u30d0\u30fc\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u7c21\u5358\u3067\u3059\u3002<br \/>\nCentOS 7 \u74b0\u5883\u3067 Yum, macOS \u74b0\u5883\u3067 Homebrew \u306b\u3088\u308b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2>Source-highlight \u306e\u30b3\u30b3\u304c\u30a4\u30b1\u3066\u308b<\/h2>\n<p>1\u3064\u76ee\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u3001ANSI \u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3068\u3057\u3066\u306e\u51fa\u529b\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3053\u3068\u3067\u3059\u3002<br \/>\nANSI \u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3068\u306f\u3001\u7aef\u672b\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u306b\u5bfe\u3057\u3066\u30e1\u30bf\u7684\u306a\u8868\u73fe\u3092\u6307\u793a\u3059\u308b\u6587\u5b57\u306e\u3053\u3068\u3067\u3059\u3002<br \/>\nSource-highlight \u306f\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4\u30c8\u3068\u3057\u3066\u3001\u30c6\u30ad\u30b9\u30c8\u8272\u5909\u66f4\u306e\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u633f\u5165\u3057\u307e\u3059\u3002<br \/>\n\u5f97\u3089\u308c\u305f\u51fa\u529b\u306f\u3001\u7aef\u672b\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u4e0a\u3067\u30ab\u30e9\u30fc\u30ea\u30f3\u30b0\u3055\u308c\u305f\u72b6\u614b\u3067\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>Source-highlight \u306f\u3001\u3053\u308c\u306e\u6709\u52b9\u306a\u4f7f\u3044\u9053\u3068\u3057\u3066 less \u30b3\u30de\u30f3\u30c9\u3068\u306e\u9023\u643a\u3092\u63d0\u6848\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nless \u306f\u975e\u5e38\u306b\u5229\u4fbf\u6027\u306e\u9ad8\u3044\u30b3\u30de\u30f3\u30c9\u3067\u3059\u304c\u3001\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4\u30c8\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u305b\u3093\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001view \u30b3\u30de\u30f3\u30c9\u306a\u3069\u3068\u6bd4\u8f03\u3057\u305f\u3068\u304d\u306b\u3001\u8996\u8a8d\u6027\u306b\u6b20\u3051\u308b\u70b9\u304c\u30c7\u30e1\u30ea\u30c3\u30c8\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3057\u3001Source-highlight \u3092\u4f7f\u3046\u3053\u3068\u3067\u3001less \u30b3\u30de\u30f3\u30c9\u3067\u3082\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4\u30c8\u304c\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<br \/>\n\u5177\u4f53\u7684\u306b\u306f\u3001\u5165\u529b\u3092\u4e00\u65e6 Source-highlight \u306b\u6e21\u3057\u3066\u3001\u51fa\u529b\u3092 less \u30b3\u30de\u30f3\u30c9\u3067\u53d7\u3051\u307e\u3059\u3002<br \/>\n\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u306b\u5fdc\u3058\u305f\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306e\u3067\u3001less \u306e\u30a4\u30f3\u30bf\u30d5\u30a7\u30a4\u30b9\u4e0a\u3067\u3082\u30ab\u30e9\u30fc\u30ea\u30f3\u30b0\u3055\u308c\u3066\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>less \u30b3\u30de\u30f3\u30c9\u3068\u306e\u9023\u643a\u306f\u3001\u74b0\u5883\u5909\u6570\u306e\u8a2d\u5b9a\u306e\u307f\u3067\u7c21\u5358\u306b\u81ea\u52d5\u5316\u3067\u304d\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u3001Source-highlight \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u4e0a\u3067\u3082\u6848\u5185\u3055\u308c\u3066\u3044\u308b\u3001\u30aa\u30d5\u30a3\u30b7\u30e3\u30eb\u306a\u65b9\u6cd5\u3067\u3059\u3002<br \/>\n\/path\/to\/src-hilite-lesspipe.sh \u306e\u90e8\u5206\u306f\u3001\u30b7\u30b9\u30c6\u30e0\u306b\u5408\u308f\u305b\u3066\u9069\u5b9c\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code>export LESSOPEN=\"| \/path\/to\/src-hilite-lesspipe.sh %s\"\r\nexport LESS=' -R '\r\n<\/code><\/pre>\n<p>2\u3064\u76ee\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u3001\u30c4\u30fc\u30eb\u3068\u3057\u3066\u306e\u62e1\u5f35\u6027\u306e\u9ad8\u3055\u3067\u3059\u3002<br \/>\n\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u306e\u89e3\u6790\u306f\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3054\u3068\u306e\u300c\u8a00\u8a9e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u300d\u306b\u57fa\u3065\u3044\u3066\u3044\u307e\u3059\u3002<br \/>\n\u591a\u304f\u306e\u8a00\u8a9e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u81ea\u4f5c\u3057\u305f\u3082\u306e\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u6271\u3044\u305f\u3044\u8a00\u8a9e\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u304b\u3063\u305f\u308a\u3001\u65b0\u3057\u3044\u8a00\u8a9e\u304c\u5c06\u6765\u73fe\u308c\u3066\u3082\u3001<br \/>\n\u8a00\u8a9e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u4f5c\u3059\u308c\u3070\u3001\u57fa\u672c\u7684\u306b\u306f\u3042\u3089\u3086\u308b\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3078\u5bfe\u5fdc\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u5165\u529b\u5f62\u5f0f\u3060\u3051\u3067\u306a\u304f\u3001\u51fa\u529b\u5f62\u5f0f\u3082\u8a00\u8a9e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u306e\u81ea\u4f5c\u306b\u3088\u3063\u3066\u8ffd\u52a0\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u306a\u3044\u3088\u3046\u306a\u9650\u3089\u308c\u305f\u7528\u9014\u3067\u3042\u3063\u3066\u3082\u3001\u305d\u308c\u306b\u5fdc\u3058\u305f\u4efb\u610f\u306e\u51fa\u529b\u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u3069\u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u306b\u3069\u306e\u8272\u3092\u5272\u308a\u5f53\u3066\u308b\u304b\u3082\u3001\u5909\u66f4\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u30b9\u30bf\u30a4\u30eb\u30d5\u30a1\u30a4\u30eb\u3068\u3044\u3046\u3082\u306e\u3092\u81ea\u4f5c\u3057\u3066\u3001\u5b9f\u884c\u6642\u306b\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h2>Source-highlight \u3092\u4f7f\u3063\u3066\u307f\u308b<\/h2>\n<p>\u30c7\u30e2\u3068\u3057\u3066\u3001Go \u8a00\u8a9e\u306e\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u3092 Source-highlight \u3092\u901a\u3057\u3066\u3001HTML \u5f62\u5f0f\u3067\u51fa\u529b\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\n\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u306e\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066\u3001A Tour of Go \u306b\u767b\u5834\u3059\u308b basic-types.go \u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u62dd\u501f\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>$ vi basic-types.go\r\npackage main\r\n\r\nimport (\r\n    \"fmt\"\r\n    \"math\/cmplx\"\r\n)\r\n\r\nvar (\r\n    ToBe   bool       = false\r\n    MaxInt uint64     = 1&lt;&lt;64 - 1\r\n    z      complex128 = cmplx.Sqrt(-5 + 12i)\r\n)\r\n\r\nfunc main() {\r\n    const f = \"%T(%v)\\n\"\r\n    fmt.Printf(f, ToBe, ToBe)\r\n    fmt.Printf(f, MaxInt, MaxInt)\r\n    fmt.Printf(f, z, z)\r\n}\r\n<\/code><\/pre>\n<p>\u65e9\u901f\u3001\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u30b3\u30de\u30f3\u30c9\u540d\u306f\u3001\u305d\u306e\u307e\u307e source-highlight \u3067\u3059\u3002<br \/>\n\u7b2c\u4e00\u5f15\u6570\u306b\u5165\u529b\u3068\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u6e21\u3057\u307e\u3059\u3002<br \/>\n\u5165\u529b\u5f62\u5f0f\u306f\u3001\u5b9f\u884c\u6642\u306b\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u62e1\u5f35\u5b50\u304b\u3089\u81ea\u52d5\u7684\u306b\u5224\u5225\u3055\u308c\u306e\u3067\u3001\u660e\u793a\u7684\u306b\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u307e\u305f\u3001\u51fa\u529b\u5f62\u5f0f\u3067\u3059\u304c\u3001HTML \u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u6307\u5b9a\u5024\u3067\u3059\u306e\u3067\u3001\u3053\u3061\u3089\u3082\u660e\u793a\u7684\u306b\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"post-pre\"><code>$ source-highlight basic-types.go\r\nProcessing basic-types.go ... created basic-types.go.html\r\n<\/code><\/pre>\n<p>\u7121\u4e8b\u3001html \u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u51fa\u529b\u7d50\u679c\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<br \/>\npre \u30bf\u30b0\u3067\u56f2\u307e\u308c\u305f HTML \u5f62\u5f0f\u306e\u51fa\u529b\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u306b\u5408\u308f\u305b\u305f font color \u30bf\u30b0\u304c\u3001\u968f\u6240\u306b\u633f\u5165\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>$ cat basic-types.go.html\r\n&lt;!-- Generator: GNU source-highlight 3.1.8\r\nby Lorenzo Bettini\r\nhttp:\/\/www.lorenzobettini.it\r\nhttp:\/\/www.gnu.org\/software\/src-highlite --&gt;\r\n&lt;pre&gt;&lt;tt&gt;&lt;b&gt;&lt;font color=\"#0000FF\"&gt;package&lt;\/font&gt;&lt;\/b&gt; main\r\n\r\n&lt;b&gt;&lt;font color=\"#0000FF\"&gt;import&lt;\/font&gt;&lt;\/b&gt; &lt;font color=\"#990000\"&gt;(&lt;\/font&gt;\r\n    &lt;font color=\"#FF0000\"&gt;\"fmt\"&lt;\/font&gt;\r\n    &lt;font color=\"#FF0000\"&gt;\"math\/cmplx\"&lt;\/font&gt;\r\n&lt;font color=\"#990000\"&gt;)&lt;\/font&gt;\r\n...\r\n\uff08\u7701\u7565\uff09\r\n<\/code><\/pre>\n<p>\u6700\u5f8c\u306b\u30d6\u30e9\u30a6\u30b6\u3067\u958b\u3044\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u3053\u3053\u3067\u306f\u3001\u30ad\u30e3\u30d7\u30c1\u30e3\u753b\u50cf\u3092\u63b2\u8f09\u3057\u307e\u3059\u3002<br \/>\n\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4\u30c8\u304c\u3001\u6b63\u3057\u304f\u306a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d609c37434c4406cfb6ae\/22-0.png\" alt=\"basic-types.go.png\" \/><\/div>\n<h2>\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u88fd\u306e\u8a00\u8a9e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3092\u9069\u7528\u3057\u3066\u307f\u308b<\/h2>\n<p>\u8fd1\u5e74\u4eba\u6c17\u3092\u96c6\u3081\u3066\u3044\u308b Rust \u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u5165\u529b\u5f62\u5f0f\u3067\u3059\u3002<br \/>\n\u3057\u304b\u3057\u3001\u6709\u5fd7\u306b\u3088\u3063\u3066 lang \u30d5\u30a1\u30a4\u30eb\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u3046\u3044\u3063\u305f\u3001\u30e6\u30fc\u30b6\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u306b\u3088\u308b\u5354\u529b\u304c\u5f97\u3089\u308c\u3084\u3059\u3044\u70b9\u306b\u304a\u3044\u3066\u3082\u3001\u62e1\u5f35\u6027\u306e\u9ad8\u3055\u306f\u6b63\u7fa9\u3068\u8a00\u3048\u307e\u3059\u3002<br \/>\n2\u3064\u76ee\u306e\u30c7\u30e2\u3068\u3057\u3066\u3001\u3053\u306e lang \u30d5\u30a1\u30a4\u30eb\u3092 Source-highlight \u306b\u9069\u7528\u3057\u3066\u3001Rust \u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u51e6\u7406\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001lang \u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<br \/>\nlang \u30d5\u30a1\u30a4\u30eb\u306f\u3001Espians \u793e\u306e tav \u3055\u3093\u304c Gist \u4e0a\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u3082\u306e\u3067\u3059\u3002<br \/>\n\u3053\u308c\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d1\u30b9\u306e share\/source-highlight \u4ee5\u4e0b\u306b\u7f6e\u304d\u307e\u3059\u3002<br \/>\n\u3061\u306a\u307f\u306b\u3001macOS \u3067 Homebrew \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u5834\u5408\u306f\u3001\/usr\/local\/ \u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d1\u30b9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>$ wget https:\/\/gist.githubusercontent.com\/tav\/3846383\/raw\/6fb082af6ee79c4f4722946f92e314f49ee8ea9c\/rust.lang\r\n... \u2018rust.lang\u2019 saved [556\/556]\r\n$ mv rust.lang \/usr\/local\/share\/source-highlight\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001Source-highlight \u306e\u8a00\u8a9e\u5bfe\u5fdc\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3057\u307e\u3059\u3002<br \/>\n\u8a00\u8a9e\u5bfe\u5fdc\u30d5\u30a1\u30a4\u30eb\u3068\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u62e1\u5f35\u5b50\u3068\u8a00\u8a9e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u306e\u5bfe\u5fdc\u4ed8\u3051\u3092\u3057\u3066\u3044\u308b\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u3053\u3068\u3067\u3059\u3002<br \/>\n\u3053\u3053\u306b\u3001rust \u62e1\u5f35\u5b50\u3068 rust.lang \u30d5\u30a1\u30a4\u30eb\u306e\u5bfe\u5fdc\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<br \/>\n\u8a00\u8a9e\u5bfe\u5fdc\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d1\u30b9\u306e share\/source-highlight\/lang.map \u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>$ echo \"rust = rust.lang\" &gt;&gt; \/usr\/local\/share\/source-highlight\/lang.map\r\n<\/code><\/pre>\n<p>\u3053\u308c\u3067\u3001\u6e96\u5099\u306f\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002<br \/>\n\u6700\u5f8c\u306b\u3001Rust \u306e\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u7528\u610f\u3057\u307e\u3059\u3002<br \/>\n\u3053\u3053\u3067\u306f\u3001Rust by Example \u304b\u3089 loop \u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u62dd\u501f\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>$ vi loop.rust\r\nfn main() {\r\n    let mut count = 0u32;\r\n\r\n    println!(\"Let's count until infinity!\");\r\n\r\n    \/\/ Infinite loop\r\n    loop {\r\n        count += 1;\r\n\r\n        if count == 3 {\r\n            println!(\"three\");\r\n\r\n            \/\/ Skip the rest of this iteration\r\n            continue;\r\n        }\r\n\r\n        println!(\"{}\", count);\r\n\r\n        if count == 5 {\r\n            println!(\"OK, that's enough\");\r\n\r\n            \/\/ Exit this loop\r\n            break;\r\n        }\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u305d\u308c\u3067\u306f\u3001Source-highlight \u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\nsource-highlight \u306b\u306f\u3001\u5404\u884c\u306e\u5148\u982d\u306b\u884c\u756a\u53f7\u3092\u4ed8\u4e0e\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u3053\u306e\u6a5f\u80fd\u3082\u4f7f\u3063\u3066\u307f\u3088\u3046\u3068\u601d\u3046\u306e\u3067\u3001&#8211;line-number \u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4ed8\u4e0e\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>$ source-highlight --line-number loop.rust\r\nProcessing loop.rust ... created loop.rust.html\r\n<\/code><\/pre>\n<p>\u3053\u3061\u3089\u3082\u3001\u554f\u984c\u306a\u304f\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067\u958b\u3044\u3066\u3001\u5b9f\u884c\u7d50\u679c\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\nRust \u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u306b\u5408\u308f\u305b\u3066\u3001\u6b63\u3057\u304f\u30ab\u30e9\u30fc\u30ea\u30f3\u30b0\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u6307\u5b9a\u3057\u305f\u884c\u756a\u53f7\u3067\u3059\u304c\u3001\u3053\u3061\u3089\u3082\u6b63\u3057\u304f\u4ed8\u4e0e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d609c37434c4406cfb6ae\/35-0.png\" alt=\"loop.rust.png\" \/><\/div>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>Source-highlight \u306f\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u975e\u4f9d\u5b58\u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4\u30c8\u30c4\u30fc\u30eb\u3067\u3059\u3002<br \/>\n\u591a\u304f\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3001\u30de\u30fc\u30af\u30a2\u30c3\u30d7\u8a00\u8a9e\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nANSI \u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u306e\u51fa\u529b\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u306e\u3067\u3001less \u306e\u30ab\u30e9\u30fc\u30ea\u30f3\u30b0\u306b\u91cd\u5b9d\u3057\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u8a00\u8a9e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3084\u30b9\u30bf\u30a4\u30eb\u3068\u3044\u3063\u305f\u4ed5\u69d8\u3092\u901a\u3057\u3066\u3001\u9ad8\u3044\u62e1\u5f35\u6027\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u307e\u3067\u8aad\u3093\u3067\u9802\u3044\u3066\u3001\u6709\u96e3\u3046\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/p>\n<h2>\u51fa\u5178<\/h2>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GNU Source-highlight 3.1.8:<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">https:\/\/www.gnu.org\/software\/src-highlite\/source-highlight.html<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5c11\u3057\u8abf\u3079\u3066\u3044\u305f\u3001Source-highlight \u306b\u3064\u3044\u3066\u307e\u3068\u3081\u307e\u3057\u305f\u3002 less \u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4 [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-45677","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>- Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:description\" content=\"\u6700\u8fd1\u5c11\u3057\u8abf\u3079\u3066\u3044\u305f\u3001Source-highlight \u306b\u3064\u3044\u3066\u307e\u3068\u3081\u307e\u3057\u305f\u3002 less \u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-16T00:36:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-04T10:54:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d609c37434c4406cfb6ae\/22-0.png\" \/>\n<meta name=\"author\" content=\"\u6e05, \u626c\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u626c\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/\",\"name\":\"- Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-01-16T00:36:59+00:00\",\"dateModified\":\"2024-05-04T10:54:38+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461\",\"name\":\"\u6e05, \u626c\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u626c\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyang\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"- Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/","og_locale":"zh_CN","og_type":"article","og_description":"\u6700\u8fd1\u5c11\u3057\u8abf\u3079\u3066\u3044\u305f\u3001Source-highlight \u306b\u3064\u3044\u3066\u307e\u3068\u3081\u307e\u3057\u305f\u3002 less \u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u30cf\u30a4\u30e9\u30a4 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-01-16T00:36:59+00:00","article_modified_time":"2024-05-04T10:54:38+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d609c37434c4406cfb6ae\/22-0.png"}],"author":"\u6e05, \u626c","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u626c","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/","name":"- Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-01-16T00:36:59+00:00","dateModified":"2024-05-04T10:54:38+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461","name":"\u6e05, \u626c","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g","caption":"\u6e05, \u626c"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyang\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/45677-2\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/45677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=45677"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/45677\/revisions"}],"predecessor-version":[{"id":100088,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/45677\/revisions\/100088"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=45677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=45677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=45677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}