nl_tokens: Sanitizes a string by replacing all hazardous LaTeX symbols with their descriptive names .
pl_tokens: function sanitize ( str ) { const symbolMap = { '\'' : '\\textquotesingle{}' , '"' : '\\textquotedbl{}' , '`' : '\\textasciigrave{}' , '^' : '\\textasciicircum{}' , '~' : '\\textasciitilde{}' , '<' : '\\textless{}' , '>' : '\\textgreater{}' , '|' : '\\textbar{}' , '\\' : '\\textbackslash{}' , '{' : '\\{' , '}' : '\\}' , '$' : '\\$' , '&' : '\\&' , '#' : '\\#' , '_' : '\\_' , '%' : '\\%' } return Array . from ( str ) . map ( <mask> => symbolMap [ char ] || char ) . join ( '' ) }