Skip to content

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

Closed

Description

@blacelle

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>

Activity

  1. nedtwigg commented on Jan 7, 2023

    @nedtwigg
    Member

    <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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions