1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
const dom = require('./dom'); /** * Parse an HTML content into metadata about a readme * * @param {String} html * @return {Object} */ function parseReadme(html) { const $ = dom.parse(html); return { title: $('h1:first-child').text().trim(), description: $('div.paragraph,p').first().text().trim() }; } module.exports = parseReadme;