Skip to content

kzima/gulp-snippet-highlight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-snippet-highlight

This gulp plugin is based on gulp-hihlight. It has been modified to allow for manual language and options 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-pre 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

About

Compile single html snippets with gulp and highlight.js.

Resources

License

Stars

Watchers

Forks

Packages

No packages published