Skip to content

Commit

Permalink
Do not add the toc2 class if the document has no section
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Jun 10, 2020
1 parent 8bf82d3 commit a2696bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/js/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ asciidoctor.browser.converter = (webExtension, Constants, Settings) => {
title: doc.getDoctitle({ use_fallback: true }),
doctype: doc.getDoctype(),
attributes: {
hasSections: doc.hasSections(),
tocPosition: doc.getAttribute('toc-position'),
isSourceHighlighterEnabled: isSourceHighlighterEnabled(doc),
isStemEnabled: isStemEnabled(doc),
Expand Down
2 changes: 1 addition & 1 deletion app/js/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ window.MathJax = {
}
updateContent(converterResponse.html)
let tocClassNames = ''
if (attributes.tocPosition === 'left' || attributes.tocPosition === 'right') {
if (attributes.hasSections && (attributes.tocPosition === 'left' || attributes.tocPosition === 'right')) {
tocClassNames = ` toc2 toc-${attributes.tocPosition}`
const tocElement = document.getElementById('toc')
if (tocElement !== null) {
Expand Down

0 comments on commit a2696bf

Please sign in to comment.