showdownjs/showdown

View on GitHub
src/subParsers/makemarkdown/header.js

Summary

Maintainability
A
0 mins
Test Coverage
showdown.subParser('makeMarkdown.header', function (node, options, globals, headerLevel) {
  'use strict';

  var headerMark = new Array(headerLevel + 1).join('#'),
      txt = '';

  if (node.hasChildNodes()) {
    txt = headerMark + ' ';
    var children = node.childNodes,
        childrenLength = children.length;

    for (var i = 0; i < childrenLength; ++i) {
      txt += showdown.subParser('makeMarkdown.node')(children[i], options, globals);
    }
  }
  return txt;
});