function randomString() {
  return Math.random().toString(16).substring(2);
}

function randomHTML(depth, width) {
  if(depth == 0) {
    return String.fromCharCode(Math.floor(Math.random() * 26) + 'a'.charCodeAt(0));
  }

  var elems = [];
  for(var i = 0; i < width; i++) {
    elems[i] = randomHTML(depth - 1, width);
  }

  var content = elems.join('');

  var attr = ' class="' + randomString() + '" id="' + randomString() + '" data-' + randomString() + '="' + randomString() + '"';

  if(depth == 1) {
    attr += ' style="color:#' + randomString().substring(0, 6) + ';"';
    if(Math.random() < 0.1) {
      return '<strong' + attr + '>' + content + '</strong>';
    } else {
      if(Math.random() < 0.5) {
        return '<span ' + attr + '>' + content + '</span>';
      } else {
        return '<a href="#' + randomString() + '" title="' + randomString() + '"' + attr + '>' + content + '</a>';
      }
    }
  } else if(depth == 2) {
    return '<p' + attr + '>' + content + '</p>';
  } else {
    return '<div' + attr + '>' + content + '</div>';
  }
}

var html = randomHTML(9, 3);
console.log(html);
