Static CMS
Star StaticJsCMS/static-cms on GitHub
v4.3.0DocsExamplesDemoCommunity

Code

  • Name: code
  • UI: Codemirror editor
  • Data type: string or { code: 'My code here', lang: 'javascript' }

The code widget provides a code editor (powered by Codemirror) with optional syntax awareness. Can output the raw code value or an object with the selected language and the raw code value.

Widget Options

For common options, see Common widget options.

NameTypeDefaultDescription
default_languagestringOptional. Default language to use
allow_language_selectionbooleanfalseOptional. Allows language syntax to be changed
keysboolean{ code: 'code', lang: 'lang' }Optional. Sets key names for code and lang if outputting an object
output_code_onlystringtrueOptional. Set to true to output the string value only
code_mirror_configbooleanfalseOptional. Config options for codemiror

Example

name: code
label: Code
widget: code