summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSheogorath2018-03-26 08:00:37 +0200
committerSheogorath2018-03-26 11:20:18 +0200
commit7681076eb3380e3fc556b3c0503621d5025b7d50 (patch)
treed15177068a7d552e81439b8b4d44e4e6304793ea
parent57c47a65dde59d355fba702bc91c63eebcc2533c (diff)
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>
Diffstat (limited to '')
-rw-r--r--public/vendor/md-toc.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/public/vendor/md-toc.js b/public/vendor/md-toc.js
index f93f7921..3457d465 100644
--- a/public/vendor/md-toc.js
+++ b/public/vendor/md-toc.js
@@ -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, '&quot;')
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