Encode and decode HTML entities

\href{http://ci.testling.com/substack/node-ent}{\texttt{ }}

\href{http://travis-ci.org/substack/node-ent}{\texttt{ }}\hypertarget{md_sfcode_node_modules_ent_readme_autotoc_md8736}{}\doxysection{example}\label{md_sfcode_node_modules_ent_readme_autotoc_md8736}

\begin{DoxyCode}{0}
\DoxyCodeLine{var ent = require('ent');}
\DoxyCodeLine{console.log(ent.encode('<span>©moo</span>'))}
\DoxyCodeLine{console.log(ent.decode('\&pi; \&amp; \&rho;')); }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{\&\#60;span\&\#62;\&\#169;moo\&\#60;/span\&\#62;}
\DoxyCodeLine{π \& ρ }

\end{DoxyCode}


\hypertarget{md_sfcode_node_modules_ent_readme_autotoc_md8737}{}\doxysection{methods}\label{md_sfcode_node_modules_ent_readme_autotoc_md8737}

\begin{DoxyCode}{0}
\DoxyCodeLine{var ent = require('ent');}
\DoxyCodeLine{var encode = require('ent/encode');}
\DoxyCodeLine{var decode = require('ent/decode'); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_ent_readme_autotoc_md8738}{}\doxysubsection{encode(str, opts=\{\})}\label{md_sfcode_node_modules_ent_readme_autotoc_md8738}
Escape unsafe characters in {\ttfamily str} with html entities.

By default, entities are encoded with numeric decimal codes.

If {\ttfamily opts.\+numeric} is false or {\ttfamily opts.\+named} is true, encoding will used named codes like {\ttfamily {$\pi$}}.

If {\ttfamily opts.\+special} is set to an Object, the key names will be forced to be encoded (defaults to forcing\+: `$<$$>$'"{}\&\`{}). For example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{console.log(encode('hello', \{ special: \{ l: true \} \})); }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{he\&\#108;\&\#108;o }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_ent_readme_autotoc_md8739}{}\doxysubsection{decode(str)}\label{md_sfcode_node_modules_ent_readme_autotoc_md8739}
Convert html entities in {\ttfamily str} back to raw text.\hypertarget{md_sfcode_node_modules_ent_readme_autotoc_md8740}{}\doxysection{credits}\label{md_sfcode_node_modules_ent_readme_autotoc_md8740}
HTML entity tables shamelessly lifted from perl\textquotesingle{}s \href{http://cpansearch.perl.org/src/GAAS/HTML-Parser-3.68/lib/HTML/Entities.pm}{\texttt{ HTML\+::\+Entities}}\hypertarget{md_sfcode_node_modules_ent_readme_autotoc_md8741}{}\doxysection{install}\label{md_sfcode_node_modules_ent_readme_autotoc_md8741}
With \href{https://npmjs.org}{\texttt{ npm}} do\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{npm install ent }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_ent_readme_autotoc_md8742}{}\doxysection{license}\label{md_sfcode_node_modules_ent_readme_autotoc_md8742}
MIT 