asciidoctor / asciidoclet

:clipboard: A Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax.
https://github.com/asciidoctor/asciidoclet
Apache License 2.0
134 stars 39 forks source link

Keep leading spaces in code block #140

Open AndreVirtimo opened 2 weeks ago

AndreVirtimo commented 2 weeks ago

Hello,

I have followed the guide to disable the creation of <p> for blank line. Now I have the problem that the IntelliJ formatting removes the leading spaces in my code block.

Example

Before:

  /**
     * Update a user by providing the data as JSON in the body.
     *
     * .Example body
     * [source,json]
     * ----
     * {
     *      "firstName": "Hans",
     *      "lastName": "Test",
     *      "email": "hans.test@example.com"
     * }
     * ----
     *
     */

After:

  /**
     * Update a user by providing the data as JSON in the body.
     *
     * .Example body
     * [source,json]
     * ----
     * {
     * "firstName": "Hans",
     * "lastName": "Test",
     * "email": "hans.test@example.com"
     * }
     * ----
     *
     */

As a workaround I can add

// @formatter:off
// @formatter:on

But I don't want to. Is there any other solution?

abelsromero commented 2 weeks ago

I am sorry to say that's an IntelliJ formatting issue and there's nothing we can do from our side. You could try disabling the automatic formatting or customizing the markers to match code blocks delimiters. But I recall IntelliJ expects different markers for start and end (haven't done on some time).

abelsromero commented 2 weeks ago

@ahus1 sorry to bring you here, you are familiar with IntellJ internals. Could it be a way to alter formatting of JavaDocs in the intellJ plugin?