Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added guidance for diataxis templates & xrefs #33981

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added guidance for diataxis templates & xrefs
Fix one sentence per line

Fix issues with sections

Fix structure

Update docs/src/main/asciidoc/doc-reference.adoc

Co-authored-by: sheilamjones <87032823+sheilamjones@users.noreply.github.com>

Update docs/src/main/asciidoc/doc-reference.adoc

Co-authored-by: sheilamjones <87032823+sheilamjones@users.noreply.github.com>
michelle-purcell and sheilamjones committed Jun 13, 2023
commit 5d6eb00a5b6b5ad778c71f82e86941cf1b0e5e36
18 changes: 10 additions & 8 deletions docs/src/main/asciidoc/doc-contribute-docs-howto.adoc
Original file line number Diff line number Diff line change
@@ -8,21 +8,23 @@ include::_attributes.adoc[]
:categories: contributing
:fn-diataxis: footnote:diataxis[Procida, D. Diátaxis documentation framework. https://diataxis.fr/]

Contribute to the documentation by using the recommended steps, workflow, and style guidance to ensure the content successfully renders on the Quarkus website portal.

== Prerequisites
Contribute to the documentation by using the recommended diataxis content types, steps, workflow, and style guidance to ensure the content successfully renders on the Quarkus website portal.

Quarkus docs use link:https://asciidoc.org/[AsciiDoc] markup.

We suggest you have the following materials nearby:
== Prerequisites

- An editor or IDE that provides syntax highlighting and previews for AsciiDoc, either natively or with a plugin.
- The https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/[AsciiDoc syntax reference]
- The xref:{doc-guides}/doc-reference.adoc[Quarkus style and content guidelines] for the required syntax, preferred style, and other conventions.
* You have an editor or IDE that provides syntax highlighting and previews for AsciiDoc, either natively or with a plugin.
* You have reviewed the following Quarkus contributor resources:
** The link:https://github.com/quarkusio/quarkus/blob/main/CONTRIBUTING.md#documentation[Documentation] section of the Quarkus "Contributing" guide.
** The xref:{doc-guides}/doc-reference.adoc[Quarkus style and content guidelines] for the required syntax, preferred style, and other conventions.
** The xref:{doc-guides}/doc-concept.adoc[Quarkus documentation content types].
* You have the https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/[AsciiDoc syntax reference] nearby.

== Locate the source files for Quarkus docs

- AsciiDoc files are in the `src/main/asciidoc` directory within the `docs` module of the {quarkus-base-url}/tree/main/docs[Quarkus GitHub repository].
- The Quarkus doc templates are located in the `src/main/asciidoc/_templates` directory within the `docs` module of the {quarkus-base-url}/tree/main/docs[Quarkus GitHub repository].
- Configuration documentation is generated from JavaDoc comments in Java source files.
- Java, YAML, and other source files can also be xref:doc-reference.adoc#reference-source-code[referenced] by AsciiDoc files.
- The link:https://quarkus.io/guides/[Quarkus documentation] menu page, also known as the doc index page, is sourced in the link:https://github.com/quarkusio/quarkusio.github.io[quarkusio.github.io] repository.
@@ -209,7 +211,7 @@ xref:<other-file-name>.adoc#title-heading[Title heading]

Breaking this example apart, we are using the `xref` macro to refer to another file (`xref:<name-of-the-file>.adoc[Human-readable label]`) and inserting the anchor ID for the target section (`#title-heading`) just after the file name.

See the xref:doc-reference.adoc#cross-references[Cross-references] section for path attributes that should be used in cross-document references.
For more guidelines on writing cross-references, including the recommended path attributes, see xref:doc-reference.adoc#cross-references[Cross-references].

== Preview and build Quarkus documentation

74 changes: 57 additions & 17 deletions docs/src/main/asciidoc/doc-reference.adoc
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc
include::_attributes.adoc[]
:categories: contributing

Guidelines are provided to help you to contribute clear and consistent content that is also sourced in the required structure and composition of Quarkus documentation.
Guidelines are provided to help you to contribute clear and consistent content that is also sourced in the required diataxis structure and composition of Quarkus documentation.

== AsciiDoc syntax

@@ -19,6 +19,8 @@ The following links provide background on AsciiDoc syntax and general convention
* https://docs.asciidoctor.org/asciidoc/latest/[AsciiDoctor User Manual]
* https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/[AsciiDoc Syntax Quick Reference]


[[lang-grammar]]
== Language and grammar

Write clear, concise, and consistent technical information in US English.
@@ -31,10 +33,14 @@ Try to use the following grammar styles:
* link:https://developers.google.com/style/tone?hl=en[A conversational tone]
* link:https://developers.google.com/style/pronouns?hl=en[Gender neutral language]


[[sentence-length]]
== Sentence length

Shorter sentences are much easier to read and translate. Try to use less than 32 words per sentence.


[[website-publish]]
== Website publication

Content from this repository is published to the https://quarkus.io/guides/[Quarkus.io website].
@@ -90,6 +96,8 @@ Your titles and headings must also follow the specific guidance for the Quarkus
|Creating an App
|===


[[file-conventions]]
== File conventions

=== Source locations
@@ -131,8 +139,12 @@ Suffix:: The file name should reflect the document type:
- References should end in `-reference.adoc`
- Tutorials should end in `-tutorial.adoc`


[[doc-structure]]
== Document structure

Use the Quarkus templates to ensure that your content is consistent with the preferred Quarkus documentation structure and style.

[[document-header]]
=== Document header

@@ -184,7 +196,7 @@ Try to write the abstract by using the following guidelines:
Ensure that the first sentence explains the value and some benefits of the content in 26 words or less.
====

If the first sentence is too long or can not be simplified to fit on the website tile, you can define a ``:summary:`` attribute in the document header attributes to serve that purpose.
If the first sentence is too long or cannot be simplified to fit on the website tile, you can define a ``:summary:`` attribute in the document header attributes to serve that purpose.
For more information, see <<doc-header-optional>>.

=== Semantic line breaks
@@ -194,14 +206,13 @@ For more information, see <<doc-header-optional>>.
Text in paragraphs, lists, and tables should be broken into pieces that are easier to review{semantic-line-breaks}.
Start a new line at the end of each sentence, and split sentences themselves at natural breaks between clauses.

=== Using sections
=== Sections

Section titles should be written in sentence case rather than title case.

All documents should start with a Title (a `= Level 0` heading), and should
be broken into subsections where appropriate
(`== Level 1` to `====== Level 5`)
without skipping any levels.
Start your document with a title, which in AsciiDoc is defined as a `= Level 0` heading.
Where appropriate, divide your content into subsections, which in AsciiDoc are defined as `== Level 1` to `====== Level 5`.
Do not skip any levels.

[TIP]
====
@@ -216,7 +227,7 @@ For example, if this is a reference, should some of this content be moved to a c
See xref:{doc-guides}/doc-concept.adoc[Quarkus documentation content types] for more information about content types and organization.
====

=== Links
== Links

In general, prefer link:https://docs.asciidoctor.org/asciidoc/latest/macros/url-macro/[url macros] to bare or automatic links.
Provide human-readable text for the link, especially if it is included in the middle of other text.
@@ -235,9 +246,13 @@ The above source produces this link:https://docs.asciidoctor.org/asciidoc/latest
=====

[[cross-references]]
=== Cross-references
== Cross-references

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doubled?

Should this be a == heading? Or should the following heading (phrasing) be ==== ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebullient - Thanks Erin for reviewing. Sorry I missed that 🌳 You are absolutely correct 👍

I pushed further change just now to promote the sections Links, Cross-references, and Source code and configuration examples from === to == and out of the Document structure section as they are big enough & popular topics in their own right. WDYT?

image

Quarkus documentation is built from source in a few different environments.

[[xref-source-attributes]]
=== Cross-reference source attributes

We use attributes in our cross-references to ensure our docs can be built across these environments.

.Cross-reference source attributes
@@ -262,7 +277,7 @@ xref:{doc-guides}/doc-concept.adoc[Quarkus Documentation concepts] <1>
<1> The cross-reference starts with `xref:`, uses a cross-reference source attribute(`\{doc-guides}`), and provides a readable description: `[Quarkus Documentation concepts]`.

[[anchors-reference]]
==== Anchors for in-file and cross-file navigation
=== Anchors for in-file and cross-file navigation

* To create an anchored ID, use lower-case characters, separate each word with `-`, and enclose the ID in `[[]]` as in the example below.
+
@@ -303,11 +318,35 @@ xref:<other-file-name>.adoc#title-heading[Title heading]
----
xref:<name-of-the-file>.adoc[Human-readable label]
----
For more details about anchored IDs, see the xref:doc-contribute-docs-howto.adoc#anchors-howto[Cross-reference in-file and cross-file content by using anchors] section.
For more details about anchored IDs, see the xref:doc-contribute-docs-howto.adoc#anchors-howto[Cross-reference in-file and cross-file content by using anchors] section of the "Contribute to Quarkus documentation" guide.

[[cross-reference-phrasing]]
=== Cross-reference phrasing

For consistency and context clarity, use the following guidelines for constructing your cross-reference phrases:

* Provide a direct hyperlink to the section, using the `xref` guidance in the previous section.
* Specify the full title of the section and use sentence case.
* Add the definite article “the” before the section title and specify “section” directly after the title.
* Add the definite article “the” and “Quarkus” before the title of the guide, unless the word “Quarkus" is already in the title.
* Insert the title of the guide between double quotations and specify “guide” directly after the title.
* If the context is needed, lead with the phrase:
** "For more information about ..."

.Correct and incorrect cross-reference phrases
[options="header"]
|====
|Correct|Incorrect
|For more information, see the xref:validation.adoc#configuring-the-validatorfactory[Configuring the ValidatorFactory] section of the Quarkus "Validation with Hibernate Validator" guide.|For more information, see the 'Configuring the ValidatorFactory' section of the xref:validation.adoc[VALIDATION WITH HIBERNATE VALIDATOR guide].
|For more information, see the xref:cache.adoc#generating-a-cache-key-with-cachekeygenerator[Generating a cache key with CacheKeyGenerator] section of the Quarkus "Application Data Caching" guide.|For more information, see xref:cache.adoc#generating-a-cache-key-with-cachekeygenerator[Generating a cache key with CacheKeyGenerator].
|
For more information, see the xref:security-openid-connect-web-authentication/.adoc#proof-of-key-for-code-exchange-pkce[PKCE-related section] of the Quarkus "OpenID Connect (OIDC) Authorization Code Flow Mechanism" guide.|For more information, see xref:security-openid-connect-web-authentication.adoc#proof-of-key-for-code-exchange-pkce[OpenID Connect (OIDC) Authorization Code Flow Mechanism].

|====

=== Reference source code

There are many ways to include source code and examples in documentation.
There are many ways to include source code and examples in the documentation.

The simplest is to write it directly in the file, like this:

@@ -320,7 +359,7 @@ System.out.println("Hello, World!");
-----

In documents like tutorials, you may want to reference source code that is built and tested regularly.
The Quarkus documentation build will copy source files enumerated in `*-examples/yaml` files into a flattened structure in the `target/asciidoc/examples` directory (from the project root).
The Quarkus documentation build copies source files enumerated in `*-examples/yaml` files into a flattened structure in the `target/asciidoc/examples` directory (from the project root).

[source,yaml]
----
@@ -366,6 +405,7 @@ examples:
// Source: integration-tests/micrometer-prometheus/src/main/java/io/quarkus/doc/micrometer/ExampleResource.java
----

[[document-attributes]]
== Document attributes and variables

[[categories]]
@@ -406,10 +446,11 @@ Tag your content to improve findability by adding at least one category to the c
:categories: contributing, data
----

[[document-variables]]
=== Quarkus documentation variables

The following variables externalize key information that can change over time. References
to such information should use the variable inside of curly brackets, `{}`.
The following variables externalize key information that can change over time.
References to such information should use the variable inside of curly brackets, `{}`.

The complete list of externalized variables for use is given in the following table:

@@ -441,5 +482,4 @@ The complete list of externalized variables for use is given in the following ta

|\{graalvm-version}|{graalvm-version}| Recommended GraalVM version to use.
|\{graalvm-flavor}|{graalvm-flavor}| The builder image tag of GraalVM to use e.g. `22.3-java17`. Use a `java17` version.
|===

|===