Because different programming languages have different syntax coloring schemes, you can specify the language of your source code using the lang
attribute to ensure that only the appropriate coloring scheme is used. Note that unless the lang
attribute is specified, Ruby is assumed to be the programming language of all source code by default.
For example, here is some source code without the lang
attribute:
# Ruby ###########################
def hello
puts "Hello world!"
end
/* C ****************************/
#include <stdio.h>
int main(int argc, char **argv) {
printf("Hello world!\n");
return 0;
}
<!-- HTML ----------------------->
<html>
<body>
Hello world!
<body>
</html>
And here is the same source code with a lang="c"
attribute:
# Ruby ###########################
def hello
puts "Hello world!"
end
/* C ****************************/
#include <stdio.h>
int main(int argc, char **argv) {
printf("Hello world!\n");
return 0;
}
<!-- HTML ----------------------->
<html>
<body>
Hello world!
<body>
</html>
And here is the same source code with a lang="html"
attribute:
# Ruby ###########################
def hello
puts "Hello world!"
end
/* C ****************************/
#include <stdio.h>
int main(int argc, char **argv) {
printf("Hello world!\n");
return 0;
}
<!-- HTML ----------------------->
<html>
<body>
Hello world!
<body>
</html>