1 module.exports = extractDescription
3 // Extracts description from contents of a readme file in markdown format
4 function extractDescription (d) {
6 if (d === "ERROR: No README data found!") return;
7 // the first block of text before the first heading
8 // that isn't the first line heading
9 d = d.trim().split('\n')
10 for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++);
12 for (var e = s + 1; e < l && d[e].trim(); e ++);
13 return d.slice(s, e).join(' ').trim()