summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-html/lib/readme.js
blob: 771b525c437b3abb3e5cec92b8dc7cbbfc7d62ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict';

var dom = require('./dom');

/**
 * Parse an HTML content into metadata about a readme
 *
 * @param {String} html
 * @return {Object}
 */
function parseReadme(html) {
    var $ = dom.parse(html);

    return {
        title: $('h1:first-child').text().trim(),
        description: $('div.paragraph,p').first().text().trim()
    };
}

module.exports = parseReadme;
//# sourceMappingURL=readme.js.map