OctoML is an HTML preprocessor for Node. It allows you to define custom (standards-breaking) HTML tags, and convert them into (valid) HTML. You can write simpler, more legible HTML. You can install with npm:

npm install octoml

To convert a file you first load OctoML, then create a new instance of the OctoML parser with a Language.

   var octoml = require('octoml');
   var lang = new octoml('lang.js'); // loads default language
   lang.load('path/to/file.xml',function(file) {
      // html text is stored in file.html
   });

In the example above the default library lang.js is loaded. This library comes bundled with OctoML, and includes the Bootstrap framework.

You can also load your own local language file:

   var lang = new octoml('./my-language.js');

Or define the language as an object:

   var lang = new octoml({
      main: [{
         tag: "box",
         html: '<div class="box">%html%</div>'
      }]
   });

For a more complete guide on how to write your own language, consult the Language Reference.

The OctoML exposes two functions load and parse. These both perform the same function - they convert an XML file into HTML. The load function loads the file from the filesystem, the parse function can be provided the file contents:

   lang.load('path/to/file.xml',function(output) {
      // converted file is in output.html
   });
   // or:
   var file = fs.readFileSync('path/to/file.xml').toString();
   lang.parse(file,'path/to/file.xml',function(output) {
      // converted file is in output.html   
   });

I may make plugins for the Grunt & Gulp task runners. In the meantime, you can add OctoML to your Gulp pipeline with through2:

var gulp = require('gulp'),
   through = require('through2'),
   octoml = require('octoml'),
   lang = new octoml('lang.js');
gulp.task('default',function() {
   return gulp.src('src/*.xml')
     .pipe(through.obj(function (file, enc, cb) {
      lang.parse(file.contents.toString(),file.path,function(b) {
         file.contents = new Buffer(b.html);
         file.path = file.path.replace(/\.xml$/,'.html');
         cb(null, file);
      });
     }))
     .pipe(gulp.dest('dist/'));
});