Skip to content

Commit 16f3fe9

Browse files
committed
archive
1 parent 2058f30 commit 16f3fe9

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

1.17/markdeep.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ var DEFAULT_OPTIONS = {
13611361
showLabels: false,
13621362
sortScheduleLists: true,
13631363
definitionStyle: 'auto',
1364-
linkAPIDefinitions: false,
1364+
linkAPIDefinitions: true,
13651365
inlineCodeLang: false,
13661366
scrollThreshold: 90,
13671367
captionAbove: {diagram: false,
@@ -3473,17 +3473,24 @@ function markdeepToHTML(str, elementMode) {
34733473
if (option('linkAPIDefinitions')) {
34743474
// API DEFINITION LINKS
34753475

3476-
var apiDefined = {};
3476+
// Maps API names to number of versions of it
3477+
var apiDefinitionCount = {};
34773478

34783479
// Find link targets for APIs, which look like:
34793480
// '<dt><code...>variablename' followed by (, [, or <
34803481
//
34813482
// If there is syntax highlighting because we're documenting
34823483
// keywords for the language supported by HLJS, then there may
34833484
// be an extra span around the variable name.
3485+
34843486
str = str.rp(/<dt><code(\b[^<>\n]*)>(<span class="[a-zA-Z\-_0-9]+">)?([A-Za-z_][A-Za-z_\.0-9:\->]*)(<\/span>)?([\(\[<])/g, function (match, prefix, syntaxHighlight, name, syntaxHighlightEnd, next) {
34853487
var linkName = name + (next === '<' ? '' : next === '(' ? '-fcn' : next === '[' ? '-array' : next);
3486-
apiDefined[linkName] = true;
3488+
var count = (apiDefinitionCount[linkName] || 0) + 1;
3489+
apiDefinitionCount[linkName] = count;
3490+
3491+
// Unique links for overloads
3492+
if (count > 1) { linkName += '-' + count; }
3493+
34873494
// The 'ignore' added to the code tag below is to
34883495
// prevent the link finding code from finding this (since
34893496
// we don't have lookbehinds in JavaScript to recognize
@@ -3501,7 +3508,7 @@ function markdeepToHTML(str, elementMode) {
35013508
// They may also have an extra syntax-highlighting span
35023509
str = str.rp(/<code(?! ignore)\b[^<>\n]*>(<span class="[a-zA-Z\-_0-9]+">)?([A-Za-z_][A-Za-z_\.0-9:\->]*)(<\/span>)?(\(\)|\[\])?<\/code>/g, function (match, syntaxHighlight, name, syntaxHighlightEnd, next) {
35033510
var linkName = name + (next ? (next[0] === '(' ? '-fcn' : next[0] === '[' ? '-array' : next[0]) : '');
3504-
return (apiDefined[linkName] === true) ? entag('a', match, 'href="#apiDefinition-' + linkName + '"') : match;
3511+
return apiDefinitionCount[linkName] ? entag('a', match, 'href="#apiDefinition-' + linkName + '"') : match;
35053512
});
35063513
}
35073514

1.17/markdeep.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

latest/markdeep.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ var DEFAULT_OPTIONS = {
13611361
showLabels: false,
13621362
sortScheduleLists: true,
13631363
definitionStyle: 'auto',
1364-
linkAPIDefinitions: false,
1364+
linkAPIDefinitions: true,
13651365
inlineCodeLang: false,
13661366
scrollThreshold: 90,
13671367
captionAbove: {diagram: false,
@@ -3473,17 +3473,24 @@ function markdeepToHTML(str, elementMode) {
34733473
if (option('linkAPIDefinitions')) {
34743474
// API DEFINITION LINKS
34753475

3476-
var apiDefined = {};
3476+
// Maps API names to number of versions of it
3477+
var apiDefinitionCount = {};
34773478

34783479
// Find link targets for APIs, which look like:
34793480
// '<dt><code...>variablename' followed by (, [, or <
34803481
//
34813482
// If there is syntax highlighting because we're documenting
34823483
// keywords for the language supported by HLJS, then there may
34833484
// be an extra span around the variable name.
3485+
34843486
str = str.rp(/<dt><code(\b[^<>\n]*)>(<span class="[a-zA-Z\-_0-9]+">)?([A-Za-z_][A-Za-z_\.0-9:\->]*)(<\/span>)?([\(\[<])/g, function (match, prefix, syntaxHighlight, name, syntaxHighlightEnd, next) {
34853487
var linkName = name + (next === '<' ? '' : next === '(' ? '-fcn' : next === '[' ? '-array' : next);
3486-
apiDefined[linkName] = true;
3488+
var count = (apiDefinitionCount[linkName] || 0) + 1;
3489+
apiDefinitionCount[linkName] = count;
3490+
3491+
// Unique links for overloads
3492+
if (count > 1) { linkName += '-' + count; }
3493+
34873494
// The 'ignore' added to the code tag below is to
34883495
// prevent the link finding code from finding this (since
34893496
// we don't have lookbehinds in JavaScript to recognize
@@ -3501,7 +3508,7 @@ function markdeepToHTML(str, elementMode) {
35013508
// They may also have an extra syntax-highlighting span
35023509
str = str.rp(/<code(?! ignore)\b[^<>\n]*>(<span class="[a-zA-Z\-_0-9]+">)?([A-Za-z_][A-Za-z_\.0-9:\->]*)(<\/span>)?(\(\)|\[\])?<\/code>/g, function (match, syntaxHighlight, name, syntaxHighlightEnd, next) {
35033510
var linkName = name + (next ? (next[0] === '(' ? '-fcn' : next[0] === '[' ? '-array' : next[0]) : '');
3504-
return (apiDefined[linkName] === true) ? entag('a', match, 'href="#apiDefinition-' + linkName + '"') : match;
3511+
return apiDefinitionCount[linkName] ? entag('a', match, 'href="#apiDefinition-' + linkName + '"') : match;
35053512
});
35063513
}
35073514

latest/markdeep.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)