Flexmark arbitrary formatter options in maven/gradle config by bentatham · Pull Request #2968 · diffplug/spotless (original) (raw)
and others added 5 commits
…ns map
Adds a flexmarkOptions map to FlexmarkConfig and the Maven plugin's Flexmark class. Each camelCase key (e.g. rightMargin) is converted to SCREAMING_SNAKE_CASE and resolved to a static DataKey field on the flexmark Formatter class via reflection. Integer, Boolean, and String option types are supported; an unknown key or unsupported type fails the build with a clear error message.
Example Maven configuration: 100
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Adds unit tests in FlexmarkStepTest verifying:
- rightMargin option wraps long paragraphs at the configured column
- an unknown option key fails with a clear IllegalArgumentException
Adds a Maven integration test in FlexmarkMavenTest verifying the flexmarkOptions XML map configuration round-trips correctly through the plugin.
Adds the corresponding test resource fixtures FlexmarkOptionsUnformatted.md / FlexmarkOptionsFormatted.md.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
…camelCase conversion to Maven plugin
- FlexmarkConfig stores SCREAMING_SNAKE_CASE keys directly; camelCase→SCREAMING_SNAKE_CASE conversion now lives in the Maven plugin (Flexmark.java) where XML element name convention originates
- Renamed flexmarkOptions→formatterOptions throughout (config field, getter/setter, @parameter, Gradle DSL method, README, tests)
- Added formatterOptions(Map) to Gradle FlexmarkExtension with a corresponding integration test
- Added emulationProfile javadoc noting it can also be set via formatterOptions as FORMATTER_EMULATION_PROFILE
- Updated plugin-maven/README.md with formatterOptions documentation and example
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})