If you install the package from npm, the built file has all languages.
How is it possible to use only some languages?
Sure. You can pass languageSubset as a parameter for highlightAuto(): http://highlightjs.readthedocs.io/en/latest/api.html#highlightauto-value-languagesubset
@isagalaev but that will not exclude the files from the packed JavaScript file or am I missing something?
in index.js we have a ton of calls to require:
var hljs = require('./highlight');
hljs.registerLanguage('1c', require('./languages/1c'));
hljs.registerLanguage('abnf', require('./languages/abnf'));
...
As far as I understand we can just avoid index.js and include highlight.js directly and then call registerLanguage for the languages we actually need?
Here's my complete example which is working for me
var hljs = require("highlight.js/lib/highlight.js");
hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));
hljs.registerLanguage('sql', require('highlight.js/lib/languages/sql'));
Thanks, @remo. This was incredibly helpful. Would love to see it documented on the website or README.
This is in the README now.
Most helpful comment
Here's my complete example which is working for me