|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: How to configure a new system with supporting libraries for compiling MHD models? |
| 4 | +date: 2025-07-03 15:09:00 |
| 5 | +description: instructions for setting up software packages and configuring systems for global simulations |
| 6 | +tags: configuration newsystem code |
| 7 | +categories: research |
| 8 | +featured: true |
| 9 | +--- |
| 10 | + |
| 11 | +This theme implements a built-in Jekyll feature, the use of Rouge, for syntax highlighting. |
| 12 | +It supports more than 100 languages. |
| 13 | +This example is in C++. |
| 14 | +All you have to do is wrap your code in markdown code tags: |
| 15 | + |
| 16 | +````markdown |
| 17 | +```c++ |
| 18 | +code code code |
| 19 | +``` |
| 20 | +```` |
| 21 | + |
| 22 | +```c++ |
| 23 | +int main(int argc, char const \*argv[]) |
| 24 | +{ |
| 25 | + string myString; |
| 26 | + |
| 27 | + cout << "input a string: "; |
| 28 | + getline(cin, myString); |
| 29 | + int length = myString.length(); |
| 30 | + |
| 31 | + char charArray = new char * [length]; |
| 32 | + |
| 33 | + charArray = myString; |
| 34 | + for(int i = 0; i < length; ++i){ |
| 35 | + cout << charArray[i] << " "; |
| 36 | + } |
| 37 | + |
| 38 | + return 0; |
| 39 | +} |
| 40 | +``` |
| 41 | +
|
| 42 | +For displaying code in a list item, you have to be aware of the indentation, as stated in [this FAQ](https://github.com/planetjekyll/quickrefs/blob/master/FAQ.md#q-how-can-i-get-backtick-fenced-code-blocks-eg--working-inside-lists-with-kramdown). You must indent your code by **(3 \* bullet_indent_level)** spaces. This is because kramdown (the markdown engine used by Jekyll) indentation for the code block in lists is determined by the column number of the first non-space character after the list item marker. For example: [download the bash script.](assets/pdf/build_gcc_13.2.0.sh) |
| 43 | +
|
| 44 | +````markdown |
| 45 | +1. We can put fenced code blocks inside nested bullets, too. |
| 46 | +
|
| 47 | + 1. Like this: |
| 48 | +
|
| 49 | + ```c |
| 50 | + printf("Hello, World!"); |
| 51 | + ``` |
| 52 | +
|
| 53 | + 2. The key is to indent your fenced block in the same line as the first character of the line. |
| 54 | +```` |
| 55 | +
|
| 56 | +Which displays: |
| 57 | +
|
| 58 | +1. We can put fenced code blocks inside nested bullets, too. |
| 59 | +
|
| 60 | + 1. Like this: |
| 61 | +
|
| 62 | + ```c |
| 63 | + printf("Hello, World!"); |
| 64 | + ``` |
| 65 | +
|
| 66 | + 2. The key is to indent your fenced block in the same line as the first character of the line. |
| 67 | +
|
| 68 | +By default, it does not display line numbers. If you want to display line numbers for every code block, you can set `kramdown.syntax_highlighter_opts.block.line_numbers` to true in your `_config.yml` file. |
| 69 | +
|
| 70 | +If you want to display line numbers for a specific code block, all you have to do is wrap your code in a liquid tag: |
| 71 | +
|
| 72 | +{% raw %} |
| 73 | +{% highlight c++ linenos %} <br/> code code code <br/> {% endhighlight %} |
| 74 | +{% endraw %} |
| 75 | +
|
| 76 | +The keyword `linenos` triggers display of line numbers. |
| 77 | +Produces something like this: |
| 78 | +
|
| 79 | +{% highlight c++ linenos %} |
| 80 | +
|
| 81 | +int main(int argc, char const \*argv[]) |
| 82 | +{ |
| 83 | +string myString; |
| 84 | +
|
| 85 | + cout << "input a string: "; |
| 86 | + getline(cin, myString); |
| 87 | + int length = myString.length(); |
| 88 | +
|
| 89 | + char charArray = new char * [length]; |
| 90 | +
|
| 91 | + charArray = myString; |
| 92 | + for(int i = 0; i < length; ++i){ |
| 93 | + cout << charArray[i] << " "; |
| 94 | + } |
| 95 | +
|
| 96 | + return 0; |
| 97 | +
|
| 98 | +} |
| 99 | +
|
| 100 | +{% endhighlight %} |
0 commit comments