cmark

My personal build of CMark ✏️

Commit
b34e19cd2f32342fafd6ae76de4e537240784f71
Parent
7b0feef72f8dd6e6d1ea61e70272fb826202e820
Author
John MacFarlane <jgm@berkeley.edu>
Date

Renamed DocParser -> Parser.

Note: library users should update their code or it will break.

Diffstat

7 files changed, 13 insertions, 13 deletions

Status File Name N° Changes Insertions Deletions
Modified dingus.html 2 1 1
Modified js/README.md 2 1 1
Modified js/bench.js 6 3 3
Modified js/bin/commonmark 2 1 1
Modified js/lib/blocks.js 8 4 4
Modified js/lib/index.js 4 2 2
Modified js/test.js 2 1 1
diff --git a/dingus.html b/dingus.html
@@ -11,7 +11,7 @@
 
 var writer = new commonmark.HtmlRenderer();
 var xmlwriter = new commonmark.XmlRenderer({ sourcepos: true });
-var reader = new commonmark.DocParser();
+var reader = new commonmark.Parser();
 
 function getQueryVariable(variable) {
   var query = window.location.search.substring(1);
diff --git a/js/README.md b/js/README.md
@@ -52,7 +52,7 @@ could transform emphasis into ALL CAPS.
 
 Here's a basic usage example:
 
-    var reader = new commonmark.DocParser();
+    var reader = new commonmark.Parser();
     var writer = new commonmark.HtmlRenderer();
     var parsed = reader.parse("Hello *world*"); // parsed is a 'Node' tree
     var result = writer.render(parsed);  // result is a string
diff --git a/js/bench.js b/js/bench.js
@@ -1,7 +1,7 @@
 var Benchmark = require('benchmark').Benchmark;
 var suite = new Benchmark.Suite();
 var fs = require('fs');
-var sm = require('./lib/index.js');
+var commonmark = require('./lib/index.js');
 // npm install showdown
 var Showdown = require('showdown').converter;
 // npm install marked
@@ -15,8 +15,8 @@ var contents = fs.readFileSync(benchfile, 'utf8');
 
 suite.add('commonmark.js markdown->html', function() {
   "use strict";
-  var doc = new sm.DocParser().parse(contents);
-  var renderer = new sm.HtmlRenderer();
+  var doc = new commonmark.Parser().parse(contents);
+  var renderer = new commonmark.HtmlRenderer();
   renderer.render(doc);
 })
 
diff --git a/js/bin/commonmark b/js/bin/commonmark
@@ -30,7 +30,7 @@ for (i = 2; i < process.argv.length; i++) {
     }
 }
 
-var parser = new commonmark.DocParser(options);
+var parser = new commonmark.Parser(options);
 var renderer;
 
 if (format === 'html') {
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
@@ -83,7 +83,7 @@ var stripFinalBlankLines = function(lns) {
 
 // DOC PARSER
 
-// These are methods of a DocParser object, defined below.
+// These are methods of a Parser object, defined below.
 
 // Returns true if parent block can contain child block.
 var canContain = function(parent_type, child_type) {
@@ -679,8 +679,8 @@ var parse = function(input) {
 };
 
 
-// The DocParser object.
-function DocParser(options){
+// The Parser object.
+function Parser(options){
     return {
         doc: new Document(),
         tip: this.doc,
@@ -702,4 +702,4 @@ function DocParser(options){
     };
 }
 
-module.exports = DocParser;
+module.exports = Parser;
diff --git a/js/lib/index.js b/js/lib/index.js
@@ -7,11 +7,11 @@
 // Basic usage:
 //
 // var commonmark = require('commonmark');
-// var parser = new commonmark.DocParser();
+// var parser = new commonmark.Parser();
 // var renderer = new commonmark.HtmlRenderer();
 // console.log(renderer.render(parser.parse('Hello *world*')));
 
 module.exports.Node = require('./node');
-module.exports.DocParser = require('./blocks');
+module.exports.Parser = require('./blocks');
 module.exports.HtmlRenderer = require('./html');
 module.exports.XmlRenderer = require('./xml');
diff --git a/js/test.js b/js/test.js
@@ -39,7 +39,7 @@ var cursor = {
 };
 
 var writer = new commonmark.HtmlRenderer();
-var reader = new commonmark.DocParser();
+var reader = new commonmark.Parser();
 
 var results = {
     passed: 0,