Skip to content

Commit 2ed2a08

Browse files
authored
Merge pull request #782 from SISheogorath/feature/showFullTitle
Add title attribute in table of contents
2 parents 65544f9 + 7681076 commit 2ed2a08

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

public/vendor/md-toc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
var j = i + 1
5555
this._elTitleElement = this.elTitleElements[i]
5656
this._elTitleElementName = this._elTitleElement.tagName
57+
this._elTitleElementTitle = this._elTitleElement.textContent.replace(/"/g, '"')
5758
this._elTitleElementText = (typeof this.process === 'function' ? this.process(this._elTitleElement) : this._elTitleElement.innerHTML).replace(/<(?:.|\n)*?>/gm, '')
5859
var id = this._elTitleElement.getAttribute('id')
5960
if (!id) {
@@ -63,7 +64,7 @@
6364
id = '#' + id
6465
}
6566

66-
this.tocContent += '<li><a href="' + id + '">' + this._elTitleElementText + '</a>'
67+
this.tocContent += '<li><a href="' + id + '" title="'+ this._elTitleElementTitle +'">' + this._elTitleElementText + '</a>'
6768

6869
if (j !== this._elTitleElementsLen) {
6970
this._elNextTitleElementName = this.elTitleElements[j].tagName

0 commit comments

Comments
 (0)