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

Keep leading spaces in code block #140

Open
AndreVirtimo opened this issue Oct 30, 2024 · 3 comments
Open

Keep leading spaces in code block #140

AndreVirtimo opened this issue Oct 30, 2024 · 3 comments
Labels

Comments

@AndreVirtimo
Copy link

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": "[email protected]"
   * }
   * ----
   *
   */

After:

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

As a workaround I can add

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

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

@abelsromero
Copy link
Member

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
Copy link
Member

@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?

@ahus1
Copy link

ahus1 commented Dec 22, 2024

I know it is a late reply ... I suggest to disable auto-formatting of JavaDoc altogether when using Asciidoclet.

When using IntelliJ, this can be done via an .editorconfig or via the IDE settings.

# Add to https://editorconfig.org/ - add "root = true" to the root one in your project
[*.java]
ij_java_doc_enable_formatting = true

Or via the IntelliJ settings:

image

I assume this resolves this issue.

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

3 participants