​PageObject: Computer code

​This PageObject renders programming code without executing it. The programming code is embedded into HTML5 <pre> and <code> tags.

HTML5 defines the following language options, from which the editor can select one:

  • HTML
  • JavaScript
  • CSS

HTML example (system generated)

<div class="fx_po_code"><pre><code class="language-LANGUAGE">CODE</code></pre></div>

​CSS example (boilerplate)

div.fx_po_code pre {
    background: #000;
    color: #fff;
    padding: .6em 1em;
    overflow-x: scroll;
}
​This PageObject renders as block element.

​Demo content

Available parameter:

  • code: [string] The value is inserted as code fragment.

Configuration example

{{ fx_page.slot("SLOT_NAME", _context, {"content": [
    {
        "type": "code", 
        "config": {
            "code": "<p>Lorem ipsum</p>"
        }
    }
] }) }}
​For more details how to implement demo content please refer to the Demo Content Documentation.