Nimbu Developer Docs
Module Reference

html

HTML sanitizing, stripping, text conversion, and encoding helpers.

What This Adds In Cloud Code

  • Sanitizes untrusted markup before storage or mailing.
  • Converts rich HTML into plain text summaries.
  • Encodes unsafe characters to HTML entities.

Quick Start

const HTML = require('html');
const safeHtml = HTML.sanitize(request.params.content || '');

API

FunctionParamsReturnsNotes
strip_html(input)input: stringstringStrips tags aggressively.
sanitize(input, options)input: string, options?: objectstringSanitizes via Loofah scrub; options currently ignored.
to_text(input)input: stringstringConverts HTML to plain text.
encode(input, options)input: stringstringEncodes to named HTML entities.

Practical Example

const HTML = require('html');

const messageHtml = HTML.sanitize(request.params.message);
const messageText = HTML.to_text(messageHtml);

Failure Modes & Gotchas

  • sanitize options are accepted but not applied.
  • Keep original raw content only if you explicitly need audit trails.

On this page