Cloud Shell tutorials support Markdown extensions to expand the capability of the language.
Code block formatting
To create a code block in your tutorial, use backticks:
```
print("hello world")
```
Code blocks support syntax highlighting and have a button to copy the code to the clipboard.
You can change the way a code block is displayed by adding a class name after
the first set of backticks. For example, to tell a code block to syntax
highlight as Python, you can add py
as a class:
```py
print
(
"hello world"
)
```
Here are some other classes you can use to change how a code block is shown:
| Class | Effect |
|---|---|
| LANGUAGE_CLASS_NAME | Change the syntax highlighting to a specified supported language . |
none
|
Don't apply syntax highlighting to the code block. |
sh
|
Format the code like terminal input. The
code is prefixed by a $
, and a button is
shown on the block that copies the code to
Cloud Shell when clicked. |
terminal
|
Format the code like terminal output.
Identical to the none
style, except it has
no copy buttons on the code block. |
Here are the supported language styles for syntax highlighting:
| Language name | Class name |
|---|---|
| C# | cs
|
| C variants | c
, cc
, cpp
, cxx
, cyc
, m
|
| Clojure | clj
|
| Coffeescript | coffee
|
| Command line | bsh
, csh
, sh
|
| CSS | css
|
| Go | go
|
| Haskell | hs
|
| Java | java
|
| Javascript | js
|
| JSON | json
|
| Kotlin | kotlin
|
| Lisp | lisp
|
| Lua | lua
|
| Markup | default-markup
, htm
, html
, mxml
, xml
, xsl
|
| OCaml, SML, F#, and similar languages | fs
, ml
|
| Perl | perl
, pl
, pm
|
| Protocol buffers | proto
|
| Python | cv
, py
|
| Ruby | rb
|
| Scala | scala
|
| SQL | sql
|
| Swift | swift
|
| VHDL '93 | vhdl
|
| Visual Basic | vb
, vbs
|
| Wiki | wiki
|
| YAML | yaml
|

