summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorHelder Pereira <helfper@gmail.com>2020-09-16 23:02:35 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-09-17 10:50:25 +0200
commit8e553dcdefe50ab534f1199c006ae7754e14bee5 (patch)
tree3131720d12b2b356b11a4d2ed1324d96f421c431 /docs
parentd4fc70a3b320a55c4f571eed806d5ad5fdf1ef14 (diff)
markup/asciidocext: Add preserveTOC option
Diffstat (limited to 'docs')
-rw-r--r--docs/content/en/content-management/formats.md55
-rw-r--r--docs/content/en/content-management/toc.md6
-rw-r--r--docs/data/docs.json3
3 files changed, 39 insertions, 25 deletions
diff --git a/docs/content/en/content-management/formats.md b/docs/content/en/content-management/formats.md
index f8ccffefd..576ce2fa3 100644
--- a/docs/content/en/content-management/formats.md
+++ b/docs/content/en/content-management/formats.md
@@ -43,7 +43,7 @@ The `markup identifier` is fetched from either the `markup` variable in front ma
## External Helpers
-Some of the formats in the table above needs external helpers installed on your PC. For example, for AsciiDoc files,
+Some of the formats in the table above need external helpers installed on your PC. For example, for AsciiDoc files,
Hugo will try to call the `asciidoctor` command. This means that you will have to install the associated
tool on your machine to be able to use these formats.
@@ -69,33 +69,48 @@ The Asciidoctor community offers a wide set of tools for the AsciiDoc format tha
[See the Asciidoctor docs for installation instructions](https://asciidoctor.org/docs/install-toolchain/). Make sure that also all
optional extensions like `asciidoctor-diagram` or `asciidoctor-html5s` are installed if required.
-Asciidoctor parameters can be customized in Hugo:
-
-Parameter | Default | Comment
---- | --- | ---
-backend | `html5` | Don't change this unless you know what you are doing.
-doctype | `article` | Currently supported Document type is `article`.
-extensions | | Possible extensions are `asciidoctor-html5s`, `asciidoctor-bibtex`, `asciidoctor-diagram`, `asciidoctor-interdoc-reftext`, `asciidoctor-katex`, `asciidoctor-latex`, `asciidoctor-mathematical`, `asciidoctor-question`, `asciidoctor-rouge`.
-attributes | | Variables to be referenced in your `adoc` file. This is a list of variable name/value maps. See [Asciidoctor#attributes](https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#attributes-and-substitutions).
-noheaderorfooter | true | Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document. Don't change this unless you know what you are doing.
-safemode | `unsafe` | Safe mode level `unsafe`, `safe`, `server` or `secure`. Don't change this unless you know what you are doing.
-sectionnumbers | `false` | Auto-number section titles.
-verbose | `false` | Verbosely print processing information and configuration file checks to stderr.
-trace | `false` | Include backtrace information on errors.
-failurelevel | `fatal` | The minimum logging level that triggers a non-zero exit code (failure).
-workingfoldercurrent | `false` | Set the working folder to the rendered `adoc` file, so [include](https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#include-files) will work with relative paths. This setting uses the `asciidoctor` cli parameter `--base-dir` and attribute `outdir=`. For rendering [asciidoctor-diagram](https://asciidoctor.org/docs/asciidoctor-diagram/) `workingfoldercurrent` must be set to `true`.
+{{% note %}}
+External `asciidoctor` command requires Hugo rendering to _disk_ to a specific destination directory. It is required to run Hugo with the command option `--destination`.
+{{% /note %}}
+
+Some [Asciidoctor](https://asciidoctor.org/man/asciidoctor/) parameters can be customized in Hugo:
+
+Parameter | Comment
+--- | ---
+backend | Don't change this unless you know what you are doing.
+doctype | Currently, the only document type supported in Hugo is `article`.
+extensions | Possible extensions are `asciidoctor-html5s`, `asciidoctor-bibtex`, `asciidoctor-diagram`, `asciidoctor-interdoc-reftext`, `asciidoctor-katex`, `asciidoctor-latex`, `asciidoctor-mathematical`, `asciidoctor-question`, `asciidoctor-rouge`.
+attributes | Variables to be referenced in your AsciiDoc file. This is a list of variable name/value maps. See [Asciidoctor's attributes](https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#attributes-and-substitutions).
+noHeaderOrFooter | Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document. Don't change this unless you know what you are doing.
+safeMode | Safe mode level `unsafe`, `safe`, `server` or `secure`. Don't change this unless you know what you are doing.
+sectionNumbers | Auto-number section titles.
+verbose | Verbosely print processing information and configuration file checks to stderr.
+trace | Include backtrace information on errors.
+failureLevel | The minimum logging level that triggers a non-zero exit code (failure).
+
+Hugo provides additional settings that don't map directly to Asciidoctor's CLI options:
+
+workingFolderCurrent
+: Sets the working directory to be the same as that of the AsciiDoc file being processed, so that [include](https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#include-files) will work with relative paths. This setting uses the `asciidoctor` cli parameter `--base-dir` and attribute `outdir=`. For rendering diagrams with [asciidoctor-diagram](https://asciidoctor.org/docs/asciidoctor-diagram/), `workingFolderCurrent` must be set to `true`.
+
+preserveTOC
+: By default, Hugo removes the table of contents generated by Asciidoctor and provides it through the built-in variable [`.TableOfContents`](/content-management/toc/) to enable further customization and better integration with the various Hugo themes. This option can be set to `true` to preserve Asciidoctor's TOC in the generated page.
+
+Below are all the AsciiDoc related settings in Hugo with their default values:
+
+{{< code-toggle config="markup.asciidocExt" />}}
+
+Example of how to set extensions and attributes:
```
-[markup.asciidocext]
+[markup.asciidocExt]
extensions = ["asciidoctor-html5s", "asciidoctor-diagram"]
workingFolderCurrent = true
- [markup.asciidocext.attributes]
+ [markup.asciidocExt.attributes]
my-base-url = "https://example.com/"
my-attribute-name = "my value"
```
-Important: External `asciidoctor` requires Hugo rendering to _disk_ to a specific destination folder. It is required to run Hugo with the command option `--destination`!
-
In a complex Asciidoctor environment it is sometimes helpful to debug the exact call to your external helper with all
parameters. Run Hugo with `-v`. You will get an output like
diff --git a/docs/content/en/content-management/toc.md b/docs/content/en/content-management/toc.md
index bee5a587b..9c02c7da6 100644
--- a/docs/content/en/content-management/toc.md
+++ b/docs/content/en/content-management/toc.md
@@ -96,14 +96,13 @@ With the preceding example, even pages with > 400 words *and* `toc` not set to `
Hugo supports table of contents with AsciiDoc content format.
-In the header of your content file, specify the AsciiDoc TOC directives, by using the macro or auto style:
+In the header of your content file, specify the AsciiDoc TOC directives necessary to ensure that the table of contents is generated. Hugo will use the generated TOC to populate the page variable `.TableOfContents` in the same way as described for Markdown. See example below:
```asciidoc
// <!-- Your front matter up here -->
-:toc: macro
+:toc:
// Set toclevels to be at least your hugo [markup.tableOfContents.endLevel] config key
:toclevels: 4
-toc::[]
== Introduction
@@ -117,7 +116,6 @@ He lay on his armour-like back, and if he lifted his head a little he could see
A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame. It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. Drops
```
-Hugo will take this AsciiDoc and create a table of contents store it in the page variable `.TableOfContents`, in the same as described for Markdown.
[conditionals]: /templates/introduction/#conditionals
[front matter]: /content-management/front-matter/
diff --git a/docs/data/docs.json b/docs/data/docs.json
index 051bc6423..465673336 100644
--- a/docs/data/docs.json
+++ b/docs/data/docs.json
@@ -1535,7 +1535,8 @@
"verbose": false,
"trace": false,
"failureLevel": "fatal",
- "workingFolderCurrent": false
+ "workingFolderCurrent": false,
+ "preserveTOC": false
}
},
"minify": {