How to use the highlight.js.configure function in highlight

To help you get started, we’ve selected a few highlight examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fortes / metalsmith-code-highlight / transform.js View on Github external
module.exports = function(options) {
  highlight.configure(options);
  let normalizedOptions = Object.assign({}, defaults, options);
  let {selector} = normalizedOptions;

  return function highlightContent(root, data, metalsmith, done) {
    Array.from(root.querySelectorAll(selector)).forEach(node => {
      highlight.highlightBlock(node);

      // Tag the parent node as well for style adjustments
      if (node.parentNode && node.parentNode.classList) {
        node.parentNode.classList.add('lang-highlight');
      }
    });

    done();
  };
};
github future-architect / cheetah-grid / packages / docs / scripts / metalsmith / metalsmith-code-highlight.js View on Github external
module.exports = function(options = {}) {
	highlightjs.configure(options);

	/**
	 * @param {Object} files files
	 * @param {Metalsmith} metalsmith metalsmith
	 * @param {Function} done done
	 * @returns {void}
	 */
	return function(files, metalsmith, done) {
		let file, data;
		for (file in files) {
			if (HTML_FILENAME_REGEXP.test(file)) {
				data = files[file];
				data.contents = Buffer.from(highlightFile(data.contents.toString()));
			}
		}
github bylexus / grunt-md2html / tasks / md2html.js View on Github external
options.markedOptions.highlight = function (code) {
            var hl = require('highlight.js');
            hl.configure(options.highlightjs.options || {});
            return hl.highlightAuto(code).value;
        };
    }
github dignifiedquire / clean-documentation-theme / src / utils.js View on Github external
constructor (options, comments) {
    this.linkerStack = new LinkerStack(options)
      .namespaceResolver(comments, (namespace) => {
        const slugger = new GithubSlugger()
        return '#' + slugger.slug(namespace)
      })

    this.options = options
    this.comments = comments
    this.formatters = createFormatters(this.linkerStack.link)
    this.options.hljs = this.options.hljs || {}

    hljs.configure(this.options.hljs)

    this.formatType = this.formatters.type
    this.autolink = this.formatters.autolink
  }
github silklabs / silk / docs / theme / default_theme / index.js View on Github external
module.exports = function (comments, options, callback) {

  var linkerStack = createLinkerStack(options)
    .namespaceResolver(comments, function (namespace) {
      var slugger = new GithubSlugger();
      return '#' + slugger.slug(namespace);
    });

  var formatters = createFormatters(linkerStack.link);

  hljs.configure(options.hljs || {});

  var sharedImports = {
    imports: {
      slug: function (str) {
        var slugger = new GithubSlugger();
        return slugger.slug(str);
      },
      shortSignature: function (section) {
        var prefix = '';
        if (section.kind === 'class') {
          prefix = 'new ';
        } else if (section.kind !== 'function') {
          return section.name;
        }
        return prefix + section.name + formatters.parameters(section, true);
      },

highlight

Highlight code syntax with node.js

Unrecognized
Latest version published 9 years ago

Package Health Score

48 / 100
Full package analysis