GitHub v1.3.1

coralite-ignore Reference

Reference

Reference for the coralite-ignore attribute: literal page regions, literal slots, script/style text, component templates, page controller scripts, and the distinction from validator pragma comments.

Coralite processes page and component HTML by default. Template tokens, custom-element compilation, hydration, validator checks, and page-controller script extraction all run unless a subtree carries the coralite-ignore attribute.

1. Default Behaviour

coralite-ignore is the single opt-out directive. There is no opt-in directive: removing the attribute restores normal processing.

Context Default With coralite-ignore
Page token interpolation Processed Literal
Custom-element compilation Processed Not compiled
Hydration Processed Not hydrated
Validator diagnostics Processed Skipped
Page-controller script extraction Processed Ignored
<script> / <style> text Never interpolated Never interpolated

2. Page Elements

Add the attribute to any page element to emit the element and its entire subtree as authored. The attribute remains in the rendered DOM.

html
Code copied!
  <div class="mustache-guide" coralite-ignore>
    <p>Use <code>{{ token }}</code> in templates.</p>
    <unknown-demo></unknown-demo>
  </div>

In this example {{ token }} stays literal, unknown-demo is not compiled or hydrated, and the page validator does not report the unknown tag.

3. Custom Elements

When coralite-ignore is placed on a custom element, the element itself is left untouched: its template is not expanded, its attributes are not token-interpolated, and nothing inside it is compiled or hydrated.

html
Code copied!
  <ui-card coralite-ignore>
    <span>{{ literal }}</span>
    <inner-demo></inner-demo>
  </ui-card>

Use this for third-party widgets or authored markup that must be preserved exactly. If only the projected content should be literal while the component still renders, mark the component's <slot> instead.

4. Component Templates

Inside a component <template>, the attribute suppresses component token extraction and replacement, nested custom-element compilation, and validator diagnostics for that subtree.

html
Code copied!
  <template id="docs-snippet">
    <pre coralite-ignore>{{ raw }}</pre>
    <p>{{ rendered }}</p>
  </template>

{{ raw }} remains literal; {{ rendered }} follows normal component processing.

5. Slots

Marking a <slot> keeps the content projected into that slot literal. The slot still projects content, but Coralite does not interpolate tokens, compile custom elements, hydrate, or validate inside the projected nodes. Slot fallback content is authored component content and is processed normally.

html
Code copied!
  <template id="code-block">
    <pre><code><slot coralite-ignore></slot></code></pre>
  </template>

Usage:

html
Code copied!
  <code-block>
    <template id="counter-card">
      <span>{{ count }}</span>
    </template>
  
    <script type="module">
      export function server () {
        return { count: 0 }
      }
    </script>
  </code-block>

The projected <template>, {{ count }}, and <script> are emitted as authored. The code-block component itself still renders, and the directive is stripped from the rendered <slot>.

Fallback content: when no slotted nodes are supplied, the slot's own children are normal component content.

html
Code copied!
  <template id="code-panel">
    <slot coralite-ignore>
      <span>Fallback uses {{ componentToken }}</span>
    </slot>
  </template>

If a component previously relied on <pre><code><slot></slot></code></pre> being implicitly literal, add coralite-ignore to the slot.

6. Scripts, Styles, and Page Controllers

<script> and <style> text is never token-interpolated, with or without the attribute. Their text is raw text by HTML semantics.

A page may declare exactly one Coralite page controller <script> — one that exports page blocks or uses definePage. The controller is removed from rendered output. Normal inline and external scripts are allowed alongside it and are never evaluated as page modules.

html
Code copied!
  <script src="/assets/analytics.js"></script>
  
  <script type="module">
    export function server () {
      return { title: 'Documentation' }
    }
  </script>

More than one Coralite controller fails the page with CORALITE-E107. A normal script that exports no Coralite page blocks is not a controller.

7. Validator Pragmas

coralite-ignore is also the prefix for validator suppression comments. The attribute and the comment pragma are separate mechanisms:

html
Code copied!
  <!-- Suppress a specific diagnostic code -->
  <!-- coralite-ignore E107 -->
  
  <!-- Suppress an unused ref warning -->
  <!-- coralite-ignore button -->

The attribute applies to markup subtrees at render time. The comment pragma applies to validator diagnostics for the surrounding source.

8. Relationship to ignoreByAttribute

coralite-ignore is not the same as the configuration options ignoreByAttribute or skipRenderByAttribute:

  • coralite-ignore keeps the element and subtree in the rendered DOM, but skips processing inside it.
  • ignoreByAttribute removes matching elements from the rendered tree.
  • skipRenderByAttribute parses matching elements but removes them before final serialization.

Use coralite-ignore when authored markup, code samples, or third-party widgets must be emitted exactly as written.