Skip to main content

Code blocks and snippets

docStatic provides two ways to include code in your documentation. Both support syntax highlighting.

Code blocks​

  1. Click the Code Block icon in the rich text editor.
  2. Click the language list and select or search for a language.
  3. Enter your code in the box.

Example:​

This is some plain text.

Code snippets​

  1. Select Code Snippet from the Embed list.
  2. Give it a Title.
  3. Select a Language.
  4. Choose a file from the list. The list is populated with all the files in the reuse/code/ folder every time you run the dev server or do a build.

Example:​

Example Title
<div>
<p>Example</p>
</div>

The advantage of using code snippets is that there is a physical file that can be unit tested.

Related topics