Comparing version 0.2.4 to 0.2.5
var a = require("array-tools"), | ||
url = require('url'), | ||
util = require("util"); | ||
@@ -23,3 +24,4 @@ | ||
} else { | ||
var linked = a.findWhere(options.data.root, { longname: longname }); | ||
var linked = a.findWhere(options.data.root, { longname: longname }), | ||
mask; | ||
if (linked){ | ||
@@ -29,4 +31,16 @@ linked.isConstructor = false; | ||
var linkText = fullName ? fullName.replace(longname, linked.name) : linked.name; | ||
return util.format("[%s](#%s)", linkText, handlebars.helpers.anchorName.call(linked, options)); | ||
mask = options.monospace ? "`[%s](#%s)`" : "[%s](#%s)"; | ||
return util.format(mask, linkText, handlebars.helpers.anchorName.call(linked, options)); | ||
} else { | ||
if (url.parse(fullName || longname).protocol) { | ||
switch (options.style) { | ||
case 'code': | ||
mask = '`[%s](%s)`'; | ||
break; | ||
case 'plain': | ||
default: | ||
mask = '[%s](%s)'; | ||
} | ||
return util.format(mask, options.caption || fullName || longname, fullName || longname); | ||
} | ||
return "`" + (fullName || longname) + "`"; | ||
@@ -33,0 +47,0 @@ } |
{ | ||
"name": "dmd", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "dmd", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/75lb/dmd.git", |
@@ -34,3 +34,3 @@ [ | ||
{ | ||
"description": "the prototype instance property", | ||
"description": "the prototype {@link http://zombo.com|instance} property", | ||
"name": "files", | ||
@@ -70,2 +70,2 @@ "longname": "module:file-set#files", | ||
} | ||
] | ||
] |
@@ -37,4 +37,14 @@ var test = require("tape"); | ||
test("linkify", function (t) { | ||
t.plan(1); | ||
fs.createReadStream("test/fixture/class.json").pipe(dmd()).on("readable", function () { | ||
var md = this.read(); | ||
t.ok(md.toString().indexOf('[instance](http://zombo.com)') >= 0); | ||
}); | ||
}); | ||
test("partials"); | ||
test("headers"); | ||
test("plugins"); | ||
test("plugins"); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
34373
104
635