C++ 高亮测试

把博客园的代码高亮改造成了 Dev-C++ 风格。

#include<bits/stdc++.h>
using namespace std;
const __int128_t aaaa=100;
#define lowbit (x&(-x))
#define int long long
class a{
	public:
		int b;
	private:
		char x;
};
struct aaa{
	int c;
}b;
union qwert{
	int a;
	double b;
};
enum{
	asd,dsa,ads
};
bool operator < (aaa a,aaa b){
	return a.c<b.c;
}
int main(){
	freopen("a.in","r",stdin);
	int a;
	long long b;
	<>!@#$%^&*():
	"hello!"
	'?'
	"long long"
	scanf
	cout<<aaaa;
	if for while break mutable
	true false
	-1 0 123 23LL 0x123 05324 0b101001001
	scanf("%d",&a)
	printf("%d\n",a);
	//aaa
	/*
	asdsad
	*/
}

基于 prismjs 改造,将代码高亮渲染引擎改为 prismjs 并复制以下代码到页面定制 CSS 代码里即可:

/*dev-c++ classic plus style code*/
code.language-cpp span.token.macro.property span{
    color:green;
    font-weight: normal;
}
code.language-cpp span.token.boolean,
code.language-cpp span.token.keyword{
    color:black;
    font-weight: bold;
}
code.language-cpp span.token.constant,
code.language-cpp span.token.class-name{
    color:black;
    font-weight: normal;
}
code.language-cpp span.token.number{
    color:purple;
}
code.language-cpp span.token.string{
    color:blue;
    font-weight: bold;
}
code.language-cpp span.token.punctuation,
code.language-cpp span.token.operator{
    color:red;
    font-weight: bold;
}
code.language-cpp span.token.comment{
    color:rgb(0, 120, 215);
    font-style: italic;
}
posted @ 2025-02-28 14:35  123asdf123  阅读(201)  评论(0)    收藏  举报