How to use the highlight.js.highlight 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 helpers / handlebars-helpers / lib / helpers / helpers-markdown.js View on Github external
highlight: function (code, lang) {
      var res;
      res = void 0;
      if (!lang) {
        return code;
      }
      switch (lang) {
      case "js":
        lang = "javascript";
      }
      try {
        return res = hljs.highlight(lang, code).value;
      } finally {
        return res || code;
      }
    }
  };
github jonschlinkert / swig-extensions / lib / markdown.js View on Github external
highlight: function (code, lang) {
    var res = void 0;
    if (!lang) {
      return code;
    }
    switch (lang) {
    case "js":
      lang = "javascript";
    }
    try {
      return res = hljs.highlight(lang, code).value;
    } finally {
      return res || code;
    }
  }
}, (opts.marked || {})));
github juliangruber / me / browser / index.js View on Github external
highlight : function(code, lang) {
      if (lang == 'js') lang = 'javascript';
      if (lang && hljs.LANGUAGES[lang]) {
        return hljs.highlight(lang, code).value;
      }
      return hljs.highlightAuto(code).value;
    }
  });
github joyeecheung / diary / gulpfile.js View on Github external
function highlightCode(code, lang) {
  if (lang) {
    return highlight.highlight(lang, code, true).value;
  } else {
    return highlight.highlightAuto(code).value;
  }
}
github babel / website / bin / build-template.js View on Github external
highlight: function (code, lang) {
    if (!lang) {
      return highlight.highlightAuto(code).value;
    }

    if (lang === "html") lang = "erb";

    if (highlight.listLanguages().indexOf(lang) >= 0) {
      return highlight.highlight(lang, code).value;
    } else {
      return code;
    }
  }
});

highlight

Highlight code syntax with node.js

Unrecognized
Latest version published 9 years ago

Package Health Score

48 / 100
Full package analysis