Skip to content

spotless:check inconsistent with spotless:apply - flexmark over MD ending with double EOL #1455

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

Closed
blacelle opened this issue Jan 4, 2023 · 1 comment
Labels

Comments

@blacelle
Copy link
Contributor

blacelle commented Jan 4, 2023

With the main branch, as reproducible in #1454, one can see that:

With a markdown file ending with a codeBlock, flexmark would format the file with 2 trailing EOL. This looks dubious, but why not. However, if combined with a generic format with endsWithNewLine, it leads to spotlessApply and spotlessCheck to be inconsistent which is a pity.

Typical markdown (\ used to escape markdown in markdown):

\```
   someCode
\```

Typical mvn conf:

<configuration>
      <formats>
	      <!-- you can define as many formats as you want, each is independent -->
	      <format>
		      <!-- define the files to apply to -->
		      <includes>
			      <include>*.md</include>
		      </includes>
		      <endWithNewline/>
	      </format>
      </formats>
      <markdown>
	      <includes>
		      <!-- You have to set the target manually -->
		      <include>**/*.md</include>
	      </includes>
      
	      <flexmark/>
	      <!-- has its own section below -->
      </markdown>
</configuration>
@nedtwigg
Copy link
Member

nedtwigg commented Jan 7, 2023

<markdown> is a specialized <format>. Every tag you can use inside <format> is also available inside <markdown>. Also order matters (see #1459). The fix here is:

<configuration>
      <markdown>
	      <includes>
		      <include>**/*.md</include>
	      </includes>
	      <flexmark/>
              <endWithNewline/>
      </markdown>
</configuration>

@nedtwigg nedtwigg closed this as completed Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants