Re: [分享] ptt code formatter 簡單版
在 ubuntu 上有另一個做法,就是使用 highlight 這個套件:
sudo apt-get install highlight
cat test.cpp | highlight -Scpp -otmp.out -Oansi
這個時候 tmp.out 就是包涵了 ansi code 的檔案,
可是現在還不能直接複製貼上,因為 ptt 是用 ^U 當 0x18 (esc)
只要把 tmp.out 內的 0x18 都換成 0x15 就可以了,
我的做法是開 gedit ,把 0x18 換成 0x15 ,再複製貼上就可以了:
#include <iostream>
using namespace std;
int main(int argc, char* argv[]) {
vector<int> xs({1, 2, 3, 4});
for (auto x : xs) {
cout << x << endl;
}
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.175.115
→
02/27 14:29, , 1F
02/27 14:29, 1F
推
02/27 15:20, , 2F
02/27 15:20, 2F
推
02/27 15:37, , 3F
02/27 15:37, 3F
討論串 (同標題文章)