Skip to content

Commit e335191

Browse files
committed
docs(readme): add note on options.resolveDocumentTitle
1 parent d675f80 commit e335191

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

README.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = function (eleventyConfig) {
3535
};
3636
```
3737

38-
### Front Matter
38+
## Front Matter
3939

4040
You can use either [Eleventy style front matter](https://www.11ty.dev/docs/data-frontmatter/#front-matter-formats) or AsciiDoc document attributes to write front matter.
4141

@@ -68,7 +68,7 @@ Hello everyone!
6868
> [!WARNING]
6969
> Asciidoctor.js converts all attribute names to lower case letters. Example `:eleventy-aTitle:` will be made available as `atitle` in front matter data (also as `eleventy-atitle` in document attributes).
7070

71-
#### Data Cascade
71+
### Data Cascade
7272

7373
Data specified using AsciiDoc style front matter override YAML (or front matter in other Eleventy supported formats).
7474

@@ -87,9 +87,36 @@ In the above case, front matter data will have `{ layout: layout-b.njk }`.
8787

8888
In the case of `title`, [the AsciiDoc document title](https://docs.asciidoctor.org/asciidoc/latest/document/title/) (including `title` and `doctitle` attributes) takes precedence over front matter.
8989

90-
### Customize with Options
90+
## Options
91+
92+
You can pass options as the second argument in `addPlugin()`.
93+
94+
### Options for this plugin
95+
96+
#### `eleventyAttributesPrefix`
97+
98+
Default value is `eleventy-`.
99+
100+
This config can be used to change the prefix string for [AsciiDoc style front matter](#front-matter).
101+
102+
#### `resolveDocumentTitle`
103+
104+
Default value is `false`.
105+
106+
If enabled, the title will be resolved from the heading of the first section in the document. Otherwise, the title will be the Level 0 heading.
107+
108+
```adoc
109+
== A second level heading
110+
111+
This text is written in AsciiDoc format.
112+
```
113+
114+
With `resolveDocumentTitle: true`, the above document will have a title (in page data). `A second level heading`.
115+
116+
### Options for Asciidoctor.js
117+
118+
All properties other than [the ones specific to the plugin](#options-for-this-plugin) will be passed to Asciidoctor.js.
91119

92-
You can pass options to `convert()` of Asciidoctor.js as second argument in `addPlugin()`.
93120
These are the [available options](https://docs.asciidoctor.org/asciidoctor.js/latest/processor/convert-options/).
94121

95122
```js
@@ -144,12 +171,6 @@ module.exports = function (eleventyConfig) {
144171

145172
Refer to [Asciidoctor.js documentation](https://docs.asciidoctor.org/asciidoctor.js/latest/extend/extensions/) to know more about extensions.
146173

147-
#### `eleventyAttributesPrefix`
148-
149-
Default value is `eleventy-`.
150-
151-
This config can be used to change the prefix string for [AsciiDoc style front matter](#front-matter).
152-
153174
### CSS Styles
154175

155176
The plugin does not include any CSS styles. It is up to you to style the content.

0 commit comments

Comments
 (0)