logo

/Code Snippet|v2.3.0

Module

Static Methods

decodeHTMLEntity(htmlEntity)decodeHTMLEntity.jsline 23

Transform the given HTML Entity string into plain string.

PARAMETERS
NameTypeDescription

htmlEntity

String

HTML Entity type string

RETURNS:
{

String

} - Plain string
EXAMPLES
var decodeHTMLEntity = require('tui-code-snippet/string/decodeHTMLEntity'); // node, commonjs

var htmlEntityString = "A 'quote' is <b>bold</b>"
var result = decodeHTMLEntity(htmlEntityString); //"A 'quote' is <b>bold</b>"

encodeHTMLEntity(html)encodeHTMLEntity.jsline 19

Transform the given string into HTML Entity string.

PARAMETERS
NameTypeDescription

html

String

String for encoding

RETURNS:
{

String

} - HTML Entity
EXAMPLES
var encodeHTMLEntity = require('tui-code-snippet/string/encodeHTMLEntity'); // node, commonjs

var htmlEntityString = "<script> alert('test');</script><a href='test'>";
var result = encodeHTMLEntity(htmlEntityString);
Resizable