This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
class TOC { | |
constructor() { | |
document.addEventListener('DOMContentLoaded', () => this.onLoad()); | |
} | |
onLoad() { | |
this.article = document.querySelector('article'); | |
const toc = this.article.querySelector('toc'); | |
if (!toc) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- <toc> element is used to inject a TOC to it --> | |
<toc></toc> | |
<style> | |
toc #toc-container { width: 100%; } | |
toc .toc-empty-item { display: block } | |
toc .toc-caption { text-align: center; margin-bottom: 15px } | |
</style> | |
<script> | |
class TOC { | |
caption = { |