How to make code block in Jekyll and Markdown
a noraml code block
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* twoSum(int* nums, int numsSize, int target) {
}
For linenumber, testing any case of using highlighter
highlight with linenos
This way is not comportable when you copy and paste the code, because of linenumber
1
2
3
4
5
6
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* twoSum(int* nums, int numsSize, int target) {
}
highlight with lineos=table
1
2
3
4
5
6
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* twoSum(int* nums, int numsSize, int target) {
}
if you use lineos=table, at that time, copy and paste is easy, linenumber doesn’t matter.
In other words,
linenos=table option is comportable with copy contents, this means when you copy code block, You can select only the code. without linenumber
you can check this stackoverflow
BUT, after I test that lineos=table and lineos, both options is the same on my gitpage.
highlight with a normal code block
1
2
3
4
5
6
7
8
```c
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* twoSum(int* nums, int numsSize, int target) {
}
```
highlight with a normal code block and lineos=table
1
2
3
4
5
6
7
8
```c
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* twoSum(int* nums, int numsSize, int target) {
}
```
Summary of highlight and code block
I think you don’t care aobut if option of highliter is lineos=table or linenos,
Because in my test both of them is the same.
what I recommend
OR
Reference
-
The Official Liquid Site Means an open-source template language.
-
The official Pygments site is short for Python syntax highlighter.