HTML Storage

Temporary HTML storage during operations.

Access:

app.getService('htmlStorage')

App code:

const htmlStorage = app.getService('htmlStorage');

Plugin:

const htmlStorage = this.app.getService('htmlStorage');

store#

Replaces matching elements (by selector name: code, embed, picture, svg, etc.) with placeholder tokens and saves their outerHTML in internal storage.

Parameters:

  • html (string) — HTML string
  • name (string) — identifier name

Returns: string

htmlStorage.store(html, 'embed');

storeComments#

Temporarily extracts HTML comments into storage so they survive subsequent tag processing, then restores code blocks.

Parameters:

  • html (string) — HTML string

Returns: string

htmlStorage.storeComments(html);

storeTemplateSyntax#

Wraps template delimiter expressions (e.g. {{ }}, {% %}) in HTML comments keyed by delimiter name to protect them during cleaning.

Parameters:

  • html (string) — HTML string
  • delims (object) — delimiter pair (e.g. ['{{', '}}'])

Returns: string

htmlStorage.storeTemplateSyntax(html, templateSyntax);

restore#

Replaces placeholder tokens with previously stored outerHTML fragments for the given storage name.

Parameters:

  • html (string) — HTML string
  • name (string) — identifier name

Returns: string

htmlStorage.restore(html, 'svg');

restoreComments#

Restores HTML comments from the storedComments array back into the HTML string.

Parameters:

  • html (string) — HTML string

Returns: string

htmlStorage.restoreComments(html);

restoreTemplateSyntax#

Restores template delimiter expressions from comment wrappers and fixes escaped {{> sequences.

Parameters:

  • html (string) — HTML string
  • delims (object) — delimiter pair (e.g. ['{{', '}}'])

Returns: string

htmlStorage.restoreTemplateSyntax(html, templateSyntax);