decodeAll
relies on
Ox.normalizeHTML
, which uses the DOM and may transform
the string
> Ox.decodeHTMLEntities('<'&">')
'<\'&">'
> Ox.decodeHTMLEntities('<'&">')
'<\'&">'
> Ox.decodeHTMLEntities('äbçdê')
'äbçdê'
> Ox.decodeHTMLEntities('äbçdê')
'äbçdê'
> Ox.decodeHTMLEntities('äbçdê', true)
'äbçdê'
> Ox.decodeHTMLEntities('β')
'β'
> Ox.decodeHTMLEntities('β', true)
'β'
> Ox.decodeHTMLEntities('<b>')
''
@*/
Ox.decodeHTMLEntities = function(string, decodeAll) {
return decodeAll
? Ox.decodeHTMLEntities(Ox.normalizeHTML(string))
: decodeHTMLEntities(string);
};
/*@
Ox.highlightHTML bar
baz', 'foobar', 'c', true) 'foobar
baz' > Ox.highlightHTML('foofoo
\`\`\`foo\`\`\` -> foo
[example](http://example.com "example.com") -> example
> Ox.parseMarkdown('*foo* **bar** `baz` ``back`tick``')
'foo bar baz
back`tick
'
> Ox.parseMarkdown('' + code + '\n
';
}
)
.replace(
/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
function(match, prev, backticks, code, next) {
return prev + ''
+ Ox.encodeHTMLEntities(code.trim()) + '
';
}
)
.replace(
/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,
function(match, all, text, id, url, rest, quote, title) {
return '' + text + '';
}
)
.replace(
/<((https?|ftp|dict):[^'">\s]+)>/gi,
'$1'
)
.replace(
/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
function(match, mail) {
return Ox.encodeEmailAddress(mail);
}
);
};
/*@
Ox.sanitizeHTML