asciidoctor / asciidoctor-firefox-addon

:wolf: An add-on for Mozilla Firefox that converts AsciiDoc files to HTML directly in the browser using Asciidoctor.js.
https://addons.mozilla.org/en-US/firefox/addon/asciidoctorjs-live-preview/
MIT License
32 stars 9 forks source link

Table of Contents not being generated #38

Closed jeffcpullen closed 9 years ago

jeffcpullen commented 9 years ago

Adding :toc: to the top of the document is not generating the table of contents as expected.

ggrossetie commented 9 years ago

Hi @jeffcpullen, you need to add a toc placement :toc: preamble, see : https://github.com/asciidoctor/asciidoctor-chrome-extension#toc

Asciidoctor 1.5.3 will make things easier: https://github.com/asciidoctor/asciidoctor/issues/1443

jeffcpullen commented 9 years ago

@Mogztter thanks for the quick feedback. I see that you've referenced the chrome extension, but the only browser available in this environment is Firefox. Neither of the suggested formats in the chrome-extension docs worked for the Firefox addon. I've included examples of the first few lines of my file just to sanity check that it isn't just user error.

Both of these fail to generate ToC = Title :toc: :toc-placement!: toc::[]

and

= Title :toc: preamble

jeffcpullen commented 9 years ago

Closing. This was NOT a bug but user error. Thanks for your help @Mogztter

ggrossetie commented 9 years ago

I see that you've referenced the chrome extension, but the only browser available in this environment is Firefox.

The documentation is more up to date on the Chrome extension but toc placement are working in both Chrome and Firefox (and also Opera because they are all using Asciidoctor.js 1.5.2).

Both of these fail to generate ToC

Can you confirm that both your examples are working ? Thanks :smile:

jeffcpullen commented 9 years ago

Tested on Firefox 38 and both ways work.

The elements of the ToC act as if they are clickable but don't jump to the section. Assuming this is expected behavior.

ggrossetie commented 9 years ago

Ok. I think you need to add :sectanchors: to add anchors on section title.

mojavelinux commented 9 years ago

Actually, I see that same behavior. It appears that something is removing the href attribute from the links in the toc. Could this be the sanitizer?

mojavelinux commented 9 years ago

All internal links (cross references) suffer from this problem. It's not just limited to the toc. Perhaps open a new issue to track?

ggrossetie commented 9 years ago

Yes you're right, this is related to #31. Links are striped away for "security" reason...