diff options
Diffstat (limited to 'packages/gitbook-asciidoc/lib/readme.js')
-rwxr-xr-x | packages/gitbook-asciidoc/lib/readme.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/gitbook-asciidoc/lib/readme.js b/packages/gitbook-asciidoc/lib/readme.js new file mode 100755 index 0000000..6ca1a83 --- /dev/null +++ b/packages/gitbook-asciidoc/lib/readme.js @@ -0,0 +1,18 @@ +var _ = require('lodash'); +var cheerio = require('cheerio'); + +var convert = require('./utils/convert'); + +function parseReadme(src) { + var html = convert(src); + $ = cheerio.load(html); + + return { + title: $("h1:first-child").text().trim(), + description: $("div.paragraph").first().text().trim() + }; +} + + +// Exports +module.exports = parseReadme; |