I. Function overview
You can insert code blocks into Docs to clearly show the code. Docs can automatically recognize more than 65 programming languages such as C, Java and Python, and highlight code according to the syntax. Docs also supports one-click code wraps to accurately display your code.
II. Procedure
- 1.Insert a code block
- •+ toolbar: In the + toolbar on the left side of Docs, select Code block.
- •Shortcuts: ⌘ + Option + C (Mac) or Ctrl + Alt + C (Windows).
- •Markdown syntax: ``` space/newline or ``` code language space/newline.
- 2.Convert to a code block
Hover your mouse over a piece of text and select Code block in the = toolbar on the left side of Docs to convert text into a code block.
- 3.Switch programming languages
In the upper-left corner of a code block, you can click to view, search for, and switch programming languages. The name of the currently selected programming language is shown in the upper-left corner of the code block.
- 4.Wrap code
In the upper-right corner of a code block, you can click to enable or disable Wrap code.
- •Enable wrap code: If the code is too long, it'll be automatically wrapped in the code block.
- •Disable wrap code: If the code is too long, it'll be displayed in a horizontal scroll bar. You can drag the scroll bar left or right to view the code in full.
III. FAQs
Q: What programming languages does the code block support?
A:
Supported languages |
ABAP |
Ada |
Apache |
Apex |
ASM |
BASH |
C |
COBOL |
CoffeeScript |
CPP |
CSharp |
CSS |
D |
Dart |
Delphi |
Dockerfile |
Django |
Erlang |
Fortran |
FoxPro |
Go |
Groovy |
Haskell |
HTML |
HTMLBars |
HTTP |
Java |
JavaScript |
JSON |
Julia |
Kotlin |
LaTeX |
Lisp |
Logo |
Lua |
Makefile |
Markdown |
MATLAB |
Nginx |
ObjectiveC |
OpenEdgeABL |
Perl |
PHP |
PostScript |
PowerShell |
Prolog |
ProtoBuf |
Python |
R |
RPG |
Ruby |
Rust |
SAS |
Scala |
Scheme |
Scratch |
SCSS |
Shell |
SQL |
Swift |
Thrift |
TypeScript |
VBScript |
VisualBasic |
XML |
YAML |
Q: Can I paste code in a code block?
A: Yes, simultaneous editing by multiple users is also supported. Once the code is pasted, Docs will automatically identify the programming language, displaying its name in the upper-left corner of the code block.