diff options
Diffstat (limited to '_posts/2015-07-15-code.md')
-rw-r--r-- | _posts/2015-07-15-code.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/_posts/2015-07-15-code.md b/_posts/2015-07-15-code.md new file mode 100644 index 0000000..2dc73ce --- /dev/null +++ b/_posts/2015-07-15-code.md @@ -0,0 +1,39 @@ +--- +layout: post +title: a post with code +date: 2015-07-15 15:09:00 +description: an example of a blog post with some code +--- +This theme implements a built-in Jekyll feature, the use of Rouge, for syntax highlighting. +It supports more than 100 languages. +This example is in C++. +All you have to do is wrap your code in a liquid tag: + +{% raw %} +{% highlight c++ linenos %} <br/> code code code <br/> {% endhighlight %} +{% endraw %} + +The keyword `linenos` triggers display of line numbers. +Produces something like this: + +{% highlight c++ linenos %} + +int main(int argc, char const \*argv[]) +{ + string myString; + + cout << "input a string: "; + getline(cin, myString); + int length = myString.length(); + + char charArray = new char * [length]; + + charArray = myString; + for(int i = 0; i < length; ++i){ + cout << charArray[i] << " "; + } + + return 0; +} + +{% endhighlight %} |