Use Cases
Use cases for typical situations you may encounter.
Add a table of contents (TOC)
Add a TOC to a document written without one, so that it’s easier to navigate and use.
Problem: A document is not written with a TOC
It’s long. It’s hard to navigate.
Solution: Use Asciidoctor Browser Extension to add a TOC
Add the toc
setting depending on your need below:
-
For all documents viewed, use a common attribute:
toc=left
-
For the current document, use a query parameters:
?toc=left
-
If editing the document, use this AsciiDoc in the header:
:toc: left
To remove a TOC that’s already there use
|
Simplify a table of contents
Reduce the TOC heading levels for a simplified view of the document.
Problem: The number of section levels and headings are many
A simple view of the TOC is needed to understand the document.
Solution: Use the viewer to reduce the TOC heading levels
Attribute toclevels
controls the section levels that are included in the TOC, from 1 to 7.
Add the toclevels
setting depending on your need below:
-
For all documents viewed, use a common attribute:
toclevels=1
-
For the current document, use a query parameters:
?toclevels=1
-
If editing the document, use this AsciiDoc in the header:
:toclevels: 1
To see more detail in the TOC, increase the toclevels value.
|
Add a simplified table of contents
To combine the use cases of Add a table of contents (TOC) and Simplify a table of contents you can set both toc
and toclevels
at the same time:
-
For all documents viewed, set these as common attributes:
toc=left toclevels=1
-
For the current document, use these query parameters:
?toc=left&toclevels=1
-
If editing the document, use this AsciiDoc in the header:
:toc: left :toclevels: 1
Writing with minimal effort
Create and write an AsciiDoc quickly using the Asciidoctor Browser Extension to apply your most commonly used settings.
Objective: Just write, leaving other settings until later if at all
Use the features of Asciidoctor Browser Extension to save time.
Solution: Put commonly used attributes into the Option: Custom Attributes String
For all documents viewed, set this custom attributes option string:
toc=left icons=font experimental source-highlighter=highlight.js
The above Custom attributes options string set the equivalent AsciiDoc attributes below:
= <title>
:toc: left (1)
:icons: font (2)
:experimental: (3)
:source-highlighter: highlight.js (4)
1 | A left hand TOC |
2 | Use Font Awesome for icons and admonition icons |
3 | Enable GUI macrosbtn:[button] for buttonkbd:[control-A] for control-A andmenu:Menu[Item,…] for select |
4 | Syntax highlighting with highlight.js |
Congratulations, you can now have a collection of AsciiDoc notes with minimal effort, and view them with the Asciidoctor Browser Extension.