summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-html/src/langs.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-html/src/langs.js')
-rwxr-xr-xpackages/gitbook-html/src/langs.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/gitbook-html/src/langs.js b/packages/gitbook-html/src/langs.js
new file mode 100755
index 0000000..2c3523f
--- /dev/null
+++ b/packages/gitbook-html/src/langs.js
@@ -0,0 +1,17 @@
+const parseSummary = require('./summary');
+
+/**
+ * Parse an HTML content into a list of language.
+ * @param {String} html
+ * @return {Array}
+ */
+function parseLangs(content) {
+ const parts = parseSummary(content).parts;
+ if (parts.length > 0) {
+ return parts[0].articles;
+ }
+
+ return [];
+}
+
+module.exports = parseLangs;