Add title attribute in table of contents
Right now the full title of an element is may not shown as the space of the ToC is limited. With this path it'll be shower on hover and this way provide more useful information. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
3
public/vendor/md-toc.js
vendored
3
public/vendor/md-toc.js
vendored
@@ -54,6 +54,7 @@
|
||||
var j = i + 1
|
||||
this._elTitleElement = this.elTitleElements[i]
|
||||
this._elTitleElementName = this._elTitleElement.tagName
|
||||
this._elTitleElementTitle = this._elTitleElement.textContent.replace(/"/g, '"')
|
||||
this._elTitleElementText = (typeof this.process === 'function' ? this.process(this._elTitleElement) : this._elTitleElement.innerHTML).replace(/<(?:.|\n)*?>/gm, '')
|
||||
var id = this._elTitleElement.getAttribute('id')
|
||||
if (!id) {
|
||||
@@ -63,7 +64,7 @@
|
||||
id = '#' + id
|
||||
}
|
||||
|
||||
this.tocContent += '<li><a href="' + id + '">' + this._elTitleElementText + '</a>'
|
||||
this.tocContent += '<li><a href="' + id + '" title="'+ this._elTitleElementTitle +'">' + this._elTitleElementText + '</a>'
|
||||
|
||||
if (j !== this._elTitleElementsLen) {
|
||||
this._elNextTitleElementName = this.elTitleElements[j].tagName
|
||||
|
||||
Reference in New Issue
Block a user