对于各种码农来说,用一个合适的编译器,选择一个舒适的颜色对于敲代码来说,是一件非常赏心悦目的事情。或者是想要使用一些高亮的颜色来进行排版,是自己的文章或博客,不太单调,最后搭配上背景图片、皮肤等,是看着非常舒适的。
下面给大家提供各种语言的代码高亮显示,其中代码均为测试代码
普通代码块
Test code block
测试代码块
Bash 代码块
switch=true
if [[ "$switch" == true ]]
then
echo "测试代码块"
else
echo "测试代码块"
fi
C 代码块
#include <stdio.h>
int main () {
printf("测试代码块\n");
return 0;
}
C++ 代码块
#include <iostream>
using namespace std;
int main()
{
cout << "测试代码块" << endl;
return 0;
}
C# 代码块
#include <iostream>
using namespace std;
int main() {
cout << "测试代码块" << endl;
return 0;
}
CLIKE 代码块
#!/bin/bash
echo "测试代码块"
# 上一个 echo 是测试用的
CSS 代码块
<!DOCTYPE html>
<html>
<title>测试代码块</title>
<head>
<style>
div
{
width:100px;
height:75px;
background-color:red;
border:1px solid black;
}
</style>
</head>
<body>
<div>测试代码块</div>
</body>
</html>
Go 代码块
package main
import "fmt"
func main () {
fmt.Println("测试代码块")
}
Handlebars 代码块
#!/bin/bash
echo "测试代码块"
# 上一个 echo 是测试用的
Java 代码块
class Untitled {
public static void main(String[] args) {
System.out.println("测试代码块");
}
}
JavaScript 代码块
<!DOCTYPE html>
<html>
<title>Web Page Design</title>
<head>
<script>
function sayHello() {
document.write("测试代码块");
}
sayHello();
</script>
</head>
<body>
</body>
</html>
Kotlin 代码块
fun main(args: Array<String>) {
println("测试代码块")
}
Markup 代码块
A First Level Header
====================
Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.
Objective 代码块
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog (@"测试代码块");
[pool drain];
return 0;
}
Perl 代码块
#
# Hello World Program in Perl
#
print "测试代码块";
PHP 代码块
<?php
phpinfo();
?>
Shell 代码块
#!/bin/bash
echo "测试代码块"
# 上一个 echo 是测试用的
Python 代码块
# encoding: utf-8
if __name__ == "__main__":
print("测试代码块")
Ruby 代码块
# Hello World Program in Ruby
puts "测试代码块";
Sql 代码块
BEGIN TRANSACTION;
/* Create a table called NAMES */
CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text);
/* Create few records in this table */
INSERT INTO NAMES VALUES(1,'测试代码块');
INSERT INTO NAMES VALUES(2,'测试代码块');
INSERT INTO NAMES VALUES(3,'测试代码块');
INSERT INTO NAMES VALUES(4,'测试代码块');
INSERT INTO NAMES VALUES(5,'测试代码块');
COMMIT;
/* Display all the records from the table */
SELECT * FROM NAMES;
Swift 代码块
import Foundation
import Glibc
let player = ["rock", "paper", "scissors", "lizard", "spock"]
srandom(UInt32(NSDate().timeIntervalSince1970))
for count in 1...3 {
print(count)
}
print(player[random() % player.count]);
VB.net 代码块
Module VBModule
Sub Main()
Console.WriteLine("测试代码块")
End Sub
End Module