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

Support AsciiDoc-style headings ( = instead of #) #55

Open
sdavids opened this issue Jan 13, 2025 · 5 comments
Open

Support AsciiDoc-style headings ( = instead of #) #55

sdavids opened this issue Jan 13, 2025 · 5 comments
Labels
enhancement New feature or request

Comments

@sdavids
Copy link

sdavids commented Jan 13, 2025

$ ./gradlew --version

------------------------------------------------------------
Gradle 8.12
------------------------------------------------------------

Build time:    2024-12-20 15:46:53 UTC
Revision:      a3cacb207fec727859be9354c1937da2e59004c1

Kotlin:        2.0.21
Groovy:        3.0.22
Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM:  17.0.13 (Eclipse Adoptium 17.0.13+11)
Daemon JVM:    Compatible with Java 17, Eclipse Temurin (from gradle/gradle-daemon-jvm.properties)
OS:            Mac OS X 12.7.6 x86_64

$ cat gradle/libs.versions.toml | grep spotlessChangelog
spotlessChangelog = "com.diffplug.spotless-changelog:3.1.2"
$ cat CHANGELOG.adoc 
= Changelog

== [Unreleased]
$ ./gradlew changelogCheck                              
> Task :changelogCheck FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':changelogCheck'.
> CHANGELOG.adoc: Needs to have '## [Unreleased]'

https://docs.asciidoctor.org/asciidoc/latest/sections/titles-and-levels/#section-level-syntax

The number of equal signs in the marker represents the section level using a 0-based index

In addition to the equals sign marker used for defining section titles, Asciidoctor recognizes the hash symbol (#) from Markdown.

@nedtwigg nedtwigg added the enhancement New feature or request label Jan 13, 2025
@sdavids
Copy link
Author

sdavids commented Jan 13, 2025

Would you like a simple fix, i.e. allow both # and =.

Or a more involved one via looking at the file extension of changelogFile or via a new DSL property changelogFormat or something similar.

@nedtwigg
Copy link
Member

Simplicity is best! I'd prefer no new DSL property, but if adding one makes the implementation simpler it would be acceptable.

@sdavids
Copy link
Author

sdavids commented Jan 14, 2025

What should happen with the error messages?

All of them assume ## [...].

One could keep the error messages as is and silently also accept == [...] or we would need to parameterize Changelog with a type (markdown/asciidoc) and then produce appropriate error messages.

The type would be determined via the file's extension.

@nedtwigg
Copy link
Member

My preference is to parameterize with an enum, determined based on the file extension. Error messages can take that same enum as an argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants