MCPcopy
hub / github.com/GitbookIO/gitbook / getLanguageForClass

Function getLanguageForClass

lib/output/modifiers/highlightCode.js:13–31  ·  view source on GitHub ↗

Return language for a code blocks from a list of class names @param {Array } @return {String}

(classNames)

Source from the content-addressed store, hash-verified

11 @return {String}
12*/
13function getLanguageForClass(classNames) {
14 return Immutable.List(classNames)
15 .map(function(cl) {
16 // Markdown
17 if (cl.search('lang-') === 0) {
18 return cl.slice('lang-'.length);
19 }
20
21 // Asciidoc
22 if (cl.search('language-') === 0) {
23 return cl.slice('language-'.length);
24 }
25
26 return null;
27 })
28 .find(function(cl) {
29 return Boolean(cl);
30 });
31}
32
33
34/**

Callers 1

highlightCodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…