toc renders as "disabled"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

toc renders as "disabled"

craigshoemaker

For some reason when I try to render a table of contents, the resulting HTML emits a comment saying "toc disabled".

Given the following AsciiDoc markup:

var content = `

:toc: macro

= Test

toc::[]

== Title 1 Test
test paragraph

== Title 2 Test
test paragraph`;

I pass it to asciidoctor.js with these options:

var options = opal.hash2(
    ['attributes'],
    {
        attributes: ['showtitle']
    });

var html = opal.Asciidoctor.$convert(content, options);

And the resulting HTML is as follows:

<h1 id="_test" class="sect0">Test</h1>
<!-- toc disabled -->
<div class="sect1">
<h2 id="_title_1_test">Title 1 Test</h2>
<div class="sectionbody">
<div class="paragraph">
<p>test paragraph</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_title_2_test">Title 2 Test</h2>
<div class="sectionbody">
<div class="paragraph">
<p>test paragraph</p>
</div>
</div>
</div>

Am I missing a setting or something to make it render the toc correctly?

Reply | Threaded
Open this post in threaded view
|

Re: toc renders as "disabled"

mojavelinux
Administrator
Blank lines in the document header.


It's also best practice to order your header as follows:

= Document Title
Optional author and revision lines
:attr1: value
:attr2: value

content

-Dan

On Tue, Jul 19, 2016 at 5:00 PM, craigshoemaker [via Asciidoctor :: Discussion] <[hidden email]> wrote:

For some reason when I try to render a table of contents, the resulting HTML emits a comment saying "toc disabled".

Given the following AsciiDoc markup:

var content = `

:toc: macro

= Test

toc::[]

== Title 1 Test
test paragraph

== Title 2 Test
test paragraph`;

I pass it to asciidoctor.js with these options:

var options = opal.hash2(
    ['attributes'],
    {
        attributes: ['showtitle']
    });

var html = opal.Asciidoctor.$convert(content, options);

And the resulting HTML is as follows:

<h1 id="_test" class="sect0">Test</h1>
<!-- toc disabled -->
<div class="sect1">
<h2 id="_title_1_test">Title 1 Test</h2>
<div class="sectionbody">
<div class="paragraph">
<p>test paragraph</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_title_2_test">Title 2 Test</h2>
<div class="sectionbody">
<div class="paragraph">
<p>test paragraph</p>
</div>
</div>
</div>

Am I missing a setting or something to make it render the toc correctly?




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/toc-renders-as-disabled-tp4827.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: toc renders as "disabled"

craigshoemaker
as always, thanks for the great info, Dan!