lib/stmd.js
function HtmlRenderer(){
  return {
    // default options:
    blocksep: '\n',  // space between blocks
    innersep: '\n',  // space between block container tag and contents
    softbreak: '\n', // by default, soft breaks are rendered as newlines in HTML
                     // set to "<br />" to make them hard breaks
                     // set to " " if you want to ignore line wrapping in source
    escape: function(s, preserve_entities) {
      if (preserve_entities) {
      return s.replace(/[&](?![#](x[a-f0-9]{1,8}|[0-9]{1,8});|[a-z][a-z0-9]{1,31};)/gi,'&amp;')
              .replace(/[<]/g,'&lt;')
              .replace(/[>]/g,'&gt;')
              .replace(/["]/g,'&quot;');
      } else {
      return s.replace(/[&]/g,'&amp;')
              .replace(/[<]/g,'&lt;')
              .replace(/[>]/g,'&gt;')
              .replace(/["]/g,'&quot;');
      }
    },
    renderInline: renderInline,
    renderInlines: renderInlines,
    renderBlock: renderBlock,
    renderBlocks: renderBlocks,
    render: renderBlock
  };
}
function HtmlRenderer(){
  return {
    // default options:
    blocksep: '\n',  // space between blocks
    innersep: '\n',  // space between block container tag and contents
    softbreak: '\n', // by default, soft breaks are rendered as newlines in HTML
                     // set to "<br />" to make them hard breaks
                     // set to " " if you want to ignore line wrapping in source
    escape: function(s, preserve_entities) {
      if (preserve_entities) {
      return s.replace(/[&](?![#](x[a-f0-9]{1,8}|[0-9]{1,8});|[a-z][a-z0-9]{1,31};)/gi,'&amp;')
              .replace(/[<]/g,'&lt;')
              .replace(/[>]/g,'&gt;')
              .replace(/["]/g,'&quot;');
      } else {
      return s.replace(/[&]/g,'&amp;')
              .replace(/[<]/g,'&lt;')
              .replace(/[>]/g,'&gt;')
              .replace(/["]/g,'&quot;');
      }
    },
    renderInline: renderInline,
    renderInlines: renderInlines,
    renderBlock: renderBlock,
    renderBlocks: renderBlocks,
    render: renderBlock
  };
}
function HtmlRenderer ( ) { return { // default options: blocksep : '\n' , // space between blocks innersep : '\n' , // space between block container tag and contents softbreak : '\n' , // by default, soft breaks are rendered as newlines in HTML // set to "<br />" to make them hard breaks // set to " " if you want to ignore line wrapping in source escape : function ( s , preserve_entities ) { if ( preserve_entities ) { return s . replace ( / [&](?![#](x[a-f0-9]{1,8}|[0-9]{1,8});|[a-z][a-z0-9]{1,31};) / gi , '&amp;' ) . replace ( / [<] / g , '&lt;' ) . replace ( / [>] / g , '&gt;' ) . replace ( / ["] / g , '&quot;' ) ; } else { return s . replace ( / [&] / g , '&amp;' ) . replace ( / [<] / g , '&lt;' ) . replace ( / [>] / g , '&gt;' ) . replace ( / ["] / g , '&quot;' ) ; } } , renderInline : renderInline , renderInlines : renderInlines , renderBlock : renderBlock , renderBlocks : renderBlocks , render : renderBlock } ; }
The HtmlRenderer object.
The HtmlRenderer object .