gulp-snippet-highlight

1.0.0 • Public • Published

This gulp plugin is based on gulp-hihlight and it is modified to allow for manual language configuration.

gulp-snippet-highlight Uses highlight.js to compile single html snippets. If no language option is specified, your snippet will be compiled with an html code highlighter as a default.

You can also pass in highlight.js configuration object as per highlight.js docs:

  • tabReplace: a string used to replace TAB characters in indentation.
  • useBR: a flag to generate
    tags instead of new-line characters in the output, useful when code is marked up using a non-
     container.
  • classPrefix: a string prefix added before class names in the generated markup, used for backwards compatibility with stylesheets.
  • languages: an array of language names and aliases restricting auto detection to only these languages. Accepts an object r

Install

npm install --save-dev gulp-snippet-highlight

Example

var gulp = require('gulp');
var highlight = require('gulp-snippet-highlight');
 
gulp.task('highlight-snippet', function () {
  return gulp.src("./src/snippet.html")
        .pipe(highlight({
         language: "html",
         configure: {},
         }))
    .pipe(gulp.dest("./docs"));
});
 

License

MIT © Kris Zima

Package Sidebar

Install

npm i gulp-snippet-highlight

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kzima