cmark
My personal build of CMark ✏️
- Commit
- 2fe4743a1303ca5dcba4018519a044e9de8e11db
- Parent
- 0f3d82b846fb70835a059542405e849a59fa2e0a
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Made 'options' a parameter of the renderer constructors...
as opposed to the 'render' function.
Added a 'colors' parameter for the ast renderer.
Diffstat
4 files changed, 28 insertions, 13 deletions
diff --git a/js/lib/html.js b/js/lib/html.js
@@ -21,7 +21,7 @@ var tag = function(name, attrs, selfclosing) {
var reHtmlTag = /\<[^>]*\>/;
-var renderNodes = function(block, options) {
+var renderNodes = function(block) {
var attrs;
var info_words;
@@ -48,7 +48,7 @@ var renderNodes = function(block, options) {
}
};
- options = options || {};
+ var options = this.options;
while ((event = walker.next())) {
entering = event.entering;
@@ -250,7 +250,7 @@ var replaceUnsafeChar = function(s) {
var reNeedsEscaping = /[&<>"]/;
// The HtmlRenderer object.
-function HtmlRenderer(){
+function HtmlRenderer(options){
return {
// default options:
softbreak: '\n', // by default, soft breaks are rendered as newlines in HTML
@@ -267,6 +267,7 @@ function HtmlRenderer(){
return s;
}
},
+ options: options || {},
render: renderNodes
};
}