While analyzing the claim in #29998, I became aware of our current settings for chomp
and fold
for spring-asciidoctor-backends in the reference documentation.
https://github.com/spring-projects/spring-framework/blob/8a44b6445d78e182c8093925b3c4b1caf76ee7b8/framework-docs/src/docs/asciidoc/attributes.adoc#L1-L2
Historically, we have maintained handcrafted code examples (in contrast to included snippets which we have recently introduced for AOT examples), sometimes with explicit package
and import
statements in order to assist the user in understanding the examples. For example, the CommonPointcuts
class explicitly declares its package com.xyz.myapp
to make it clear in subsequent examples where shared pointcuts are derived from (e.g., com.xyz.myapp.CommonPointcuts.businessService()
).
As far as I understand the feature set of spring-asciidoctor-backends
, it is not possible to "un-chomp" (i.e., show) chomped package
statements; whereas, it is possible to un-fold folded import
statements (even if not readily apparent to the user).
However, for handcrafted examples that intentionally include package
and import
statements I think we should show those by default, especially since the user has no way to show the package
statements that have been chomped.
On the other hand, if the package
statement is irrelevant -- for example, when including code snippets from a real source file in the framework-docs
project -- it then makes sense to chomp package
statements.
I am therefore creating this issue for the team to decide how to deal with chomping and folding defaults across the reference documentation, specifically with regard to handcrafted vs. included code snippets.