asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
285 stars 120 forks source link

Split content based on toc level #598

Closed himanshu-setia closed 1 year ago

himanshu-setia commented 3 years ago

Hi,

I am using asciidoctor gradle plugin and looking for a way to split the documentation content into multiple html files based on toc levels, at build time. Right now, the entire content is published as one BIG index.html. I am using toclevels : 1. Essentially, I don't want the reader to view one big html file, but rather have an easy navigation experience through the documentation.

Take an example toc.

- What's FunBot
- What's new in FunBot 2.0
- Setup FunBot
    - Section 1
    - Section 2
    - Section 3

I am looking to split the BIG index.html in a way that it has only the table of contents and each of the sections published in the TOC, have their own html files. These section wise html files should be connected and reader should be able to move from section 1 to section 2 by following links on section 1.

Appreciate any help on this.

abelsromero commented 3 years ago

That's more a feature for the core converter than the plugin, and is not a supported nor a goal of the project. If you are building a site with multiple pages I can think of several options:

  1. Keep it as a single page: don't understimate it, some people prefer it for the simplicity and ease of search it provides. Keep in mind that if you split into pages users won't be able to search unless you integrate some search index/word database.
  2. Build separate documents and handle the global TOC on your own. That I image is what you want to avoid.
  3. Use a site generator: this will solve current and future issues, that arise from split content (eg. internal cross-references). My recommended one is Antora, but depending on what you want to achieve and background there's a learning curve and additional configurations.
  4. Try third-party extensions like https://github.com/owenh000/asciidoctor-multipage. Haven't used myself, but this https://github.com/owenh000/asciidoctor-multipage seems to match what I understand you need.
ysb33r commented 1 year ago

This is not a plugin issue.