Skip to content

Commit 631394f

Browse files
committed
fixes problem if a [] is found
1 parent 332b66c commit 631394f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

build/make_default_helpers.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,16 @@ module.exports = function(docMap, config, getCurrent, Handlebars){
7070

7171
var stripMarkdown = function(content) {
7272
var html = helpers.makeHtml(content).replace(linksRegExp, function(str) {
73-
str = str.replace(/[\[]|[\]]/g, '');
74-
var parts = str.match(linkRegExp);
73+
var noBrackets = str.replace(/[\[]|[\]]/g, '');
74+
var parts = noBrackets.match(linkRegExp);
7575
if (parts && parts[2]) {
7676
return parts[2];
7777
}
78-
return parts[1].split('\/').pop();
78+
if(parts) {
79+
return parts[1].split('\/').pop();
80+
} else {
81+
return str;
82+
}
7983
});
8084
return striptags(html).trim();
8185
};
@@ -297,7 +301,7 @@ module.exports = function(docMap, config, getCurrent, Handlebars){
297301
}
298302
if (!attrs.title) {
299303
var linkTitle = docObject.description || name;
300-
attrs.title = stripMarkdown(linkTitle);
304+
attrs.title = stripMarkdown(linkTitle);
301305
}
302306
var attrsArr = [];
303307
for(var prop in attrs){

0 commit comments

Comments
 (0)