{"size": 424, "ext": "js", "max_stars_repo_path": "packages/Organisms/Markup/markup-transpiler.js", "max_stars_repo_name": "geelen/ripple", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "packages/Organisms/Markup/markup-transpiler.js", "max_issues_repo_name": "geelen/ripple", "max_issues_repo_issues_event_min_datetime": "2018-12-05T05:17:32.000Z", "max_issues_repo_issues_event_max_datetime": "2018-12-05T05:17:32.000Z", "max_forks_repo_path": "packages/Organisms/Markup/markup-transpiler.js", "max_forks_repo_name": "geelen/ripple", "max_forks_repo_forks_event_min_datetime": "2018-12-03T23:46:09.000Z", "max_forks_repo_forks_event_max_datetime": "2018-12-03T23:46:09.000Z"}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 24.9411764706, "max_line_length": 82, "alphanum_fraction": 0.6627358491}
import cheerio from 'cheerio'

const markupTranspiler = (html, plugins, options = { decodeEntities: false }) => {
  const $ = cheerio.load(html, options)
  const $body = $('body')

  // Load plugins to transpile embedded components
  for (const [index, plugin] of plugins.entries()) {
    $.prototype[`plugin${index}`] = plugin
    $body[`plugin${index}`]()
  }

  return $('body').html()
}

export default markupTranspiler
