Markdown小技巧:程式碼格式、縮排和字型大小
阿新 • • 發佈:2018-12-27
程式碼格式
可以用<pre name="code" class="java"></pre>
包裹住程式碼塊,例如:
<pre name="code" class="java">這是一個Java程式碼</pre>
public class Demo{
public static void main(String[] args) {
// 這是一個Java程式碼
}
}
<pre name="code" class="c++">
#include <stdio.h>
#include <cstring>
#include <cstdio>
int main(int argc, char const *argv[])
{
int a = 1;
String str = "abc";
scanf("%d", &a);
cout <<"str:"<< str << endl;
return 0;
}
</pre>
#include <stdio.h> #include <cstring> #include <cstdio> int main(int argc, char const *argv[]) { int a = 1; String str = "abc"; scanf("%d", &a); cout <<"str:"<< str << endl; return 0; }
縮排
可以將輸入法改為全形然後在段首按空格:
或在段首新增  
 或在段首新增 ` `
字型大小
例如:字型<font size=4>大小<font size=6>調節
字型大小調節