highlight-self-hide-semicolons.js 626 B

1234567891011121314151617181920212223
  1. /*
  2. * This file will highlight itself using a custom theme when run via: "node highlight-self-hide-semicolons"
  3. * The custom theme highlights semicolons as 'black', thus hiding them.
  4. */
  5. var cardinal = require('..')
  6. , hideSemicolonsTheme = require('../themes/hide-semicolons');
  7. function highlight () {
  8. // Using the synchronous highlightFileSync()
  9. // For asynchronous highlighting use: highlightFile() - see highlight-self.js
  10. try {
  11. var highlighted = cardinal.highlightFileSync(__filename, hideSemicolonsTheme);
  12. console.log(highlighted);
  13. } catch (err) {
  14. console.error(err);
  15. }
  16. }
  17. highlight();