Working with Source Code
Scalar offers the ability to embed and annotate source code. The process for including source code in your project depends on how you want it to appear and what you want to do with it.
Annotatable code and syntax highlighting (by default)
Scalar supports annotations and syntax highlighting by default for the following file formats:Extension | Format |
---|---|
.css | CSS |
.java | Java |
.js | JavaScript |
.xml | XML |
Annotatable code and syntax highlighting (with a little extra work)
With two additional steps, Scalar will also support annotations and syntax highlighting for these file formats:Extension | Format |
---|---|
.c | C |
.cpp | C++ |
.cs | C# |
.html | HTML |
.php | PHP |
.py | Python |
.rb | Ruby |
To enable annotations and syntax highlighting for these formats, you must do the following:
- Rename the file’s extension to .code before uploading to Scalar.
- After uploading, edit the file and add one of the following suffixes to its Media file URL depending on the language the code is written in:
Suffix | Format |
---|---|
?lang=c | C |
?lang=cplus | C++ |
?lang=csharp | C# |
?lang=markup | HTML |
?lang=php | PHP |
?lang=python | Python |
?lang=ruby | Ruby |