If you add code to your Post you can choose to add the appropriate highlighting and formatting for the type of code that you are adding. You can select from a list of code types available, or if your code type is not available, you can format it with a standard code font. Using the code markup also ensures that the code is displayed using your original spacing when you save the Post.
In addition to the standard code font and retaining spacing, the following code types can be displayed with syntax highlighting:
|* ASP||* Perl|
|* Bash||* PHP|
|* C||* RDF|
|* C++||* SQL|
|* CSS||* Text|
|* Matlab||* Java|
The following image shows the Format Code button and menu:
To format the code in your Post:
- Add the code into the Post
- Select the code that you want to format
- Click Format Code and select the code type from the list of options in the menu. Alternatively, click the Text button if your code type is not available.
You can also manually add the code markup. The markup for generic code is:
[code][/code]. To change the markup to get syntax formatting for your code format if it is supported, use
[code=<language>][/code] where <language> is your code format, for example
What to do next
- For more options for formatting a Post, see Formatting an eNotebook entry.
- To find out how to create a Post, see Creating eNotebook entries.
- To find out how to add special and accented characters to your Post, see Using special characters.
- For information on editing a Post and viewing previous versions of a Post, see Editing an eNotebook entry and viewing revisions.
- To find out how to create links to other Posts and external resources in your Post, see Linking to other eNotebook entries and Linking to external resources.
- To find out how to attach data files and pictures to your Posts, see Uploading data.
- For guidance on creating Posts for recording experiments, see Recording experiments.