diff options
author | olOwOlo <26087907+olOwOlo@users.noreply.github.com> | 2018-01-13 20:34:14 +0800 |
---|---|---|
committer | olOwOlo <26087907+olOwOlo@users.noreply.github.com> | 2018-01-13 20:34:14 +0800 |
commit | e1f5be88d365dfa31b88b552f331460d73f31ca7 (patch) | |
tree | 229b5a4bc6550c8739b76e8ad7af0dfbb249e6f5 /src | |
parent | 5e2df2d9db1de8e52c209b0597bd8b152381e914 (diff) |
fix: error when heading contains link (#20)
release 2.7.2
Diffstat (limited to 'src')
-rw-r--r-- | src/js/even.js | 5 | ||||
-rw-r--r-- | src/package.json | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/js/even.js b/src/js/even.js index 33ca2f3..0d5813a 100644 --- a/src/js/even.js +++ b/src/js/even.js @@ -183,6 +183,7 @@ Even.toc = function () { } Even._refactorToc = function (toc) { + // when headings do not start with `h1` const oldTocList = toc.children[0] let newTocList = oldTocList let temp @@ -192,14 +193,14 @@ Even._refactorToc = function (toc) { } Even._linkToc = function () { - const links = document.querySelectorAll('#TableOfContents a') + const links = document.querySelectorAll('#TableOfContents a:first-child') for (let i = 0; i < links.length; i++) links[i].className += ' toc-link' for (let num = 1; num <= 6; num++) { const headers = document.querySelectorAll('.post-content>h' + num) for (let i = 0; i < headers.length; i++) { const header = headers[i] - header.innerHTML = `<a href="#${header.id}" class="headerlink" title="${header.innerHTML}"></a>${header.innerHTML}` + header.innerHTML = `<a href="#${header.id}" class="headerlink"></a>${header.innerHTML}` } } } diff --git a/src/package.json b/src/package.json index dcae54f..ffc23a8 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "even-src", - "version": "2.7.1", + "version": "2.7.2", "description": "even source file", "main": "index.js", "scripts": { |