How to use the detergent.detergent function in detergent

To help you get started, we’ve selected a few detergent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maxlapides / dovetailer / lib / handlebars.js View on Github external
function markdownObj(data) {
  // string
  if (_.isString(data)) {
    if (data.startsWith('mailto:')) return data

    // clean with detergent then parse as markdown
    const cleanData = detergent(data, { addMissingSpaces: false }).res
    return marked(cleanData, { renderer })

  // error case: bad data
  if (!data) {
    logger.error(`Bad JSON! ${data} is not parsable as Markdown.`)
    return {}

  // array
  if (_.isArray(data)) {

  // object
  return _.reduce(


Extract, clean, encode text and fix English style

Latest version published 21 days ago

Package Health Score

73 / 100
Full package analysis

Popular detergent functions