Static Methods
decodeHTMLEntity(htmlEntity)decodeHTMLEntity.jsline 26
Transform the given HTML Entity string into plain string.
PARAMETERS
Name Type Description htmlEntity
String
HTML Entity type string
RETURNS:
{String
} - Plain stringEXAMPLES
// ES6 import decodeHTMLEntity from 'tui-code-snippet/string/decodeHTMLEntity'; // CommonJS const decodeHTMLEntity = require('tui-code-snippet/string/decodeHTMLEntity'); const htmlEntityString = "A 'quote' is <b>bold</b>" const result = decodeHTMLEntity(htmlEntityString); //"A 'quote' is <b>bold</b>"
encodeHTMLEntity(html)encodeHTMLEntity.jsline 22
Transform the given string into HTML Entity string.
PARAMETERS
Name Type Description html
String
String for encoding
RETURNS:
{String
} - HTML EntityEXAMPLES
// ES6 import encodeHTMLEntity from 'tui-code-snippet/string/encodeHTMLEntity'; // CommonJS const encodeHTMLEntity = require('tui-code-snippet/string/encodeHTMLEntity'); const htmlEntityString = "<script> alert('test');</script><a href='test'>"; const result = encodeHTMLEntity(htmlEntityString);