asciidoctor/asciidoctor-intellij-plugin

Additional reformat option for spaces between headings

Open

#428 opened on Mar 20, 2020

View on GitHub
 (8 comments) (5 reactions) (0 assignees)Java (155 forks)auto 404
enhancementgood first issue

Repository metrics

Stars
 (392 stars)
PR merge metrics
 (PR metrics pending)

Description

Enhancement proposal

I love Code > Reformat Code to clean up my asciidoc pages. However, after reformatting there is only a single line before all paragraphs and headings.

For myself, I prefer a little bit more "air" before my headings, two or three lines, say.

Perhaps this could be made into a setting that can be tweaked.

Maintainer notes (by @ahus1)

Good First Issue

This issue is labeled "good first issue", and maintainers are willing to help. Please comment in this ticket to exchange ideas how this could be implemented. Feel free to pair up with a maintainer to help when you don't know where to start if when you're stuck.

Find out more about how to contribute at "Contribute as a coder" in the Contributor's guide.

Implementation Idea

There has been a pull request #633 that implemented the number of blank lines after a heading. Now as this is about adding blank lines before a heading, implementors can use the code changes performed there as a blueprint to implement this feature request. Please note that the file AsciiDocBlock.java has been renamed to AsciiDocFormattingBlock.java in the meantime.

  1. Starting point to add a settings for this would be AsciiDocLanguageCodeStyleSettingsProvider. Then the user can configure this via the settings in "Code Style > AsciiDoc" or via an .editorconfig file.

  2. Once the configuration option is available, the formatting in AsciiDocFormattingBlock can pick it up like it already picks up the configuration for ONE_SENTENCE_PER_LINE.

  3. There are some existing tests regarding formatting in AsciiDocFormattingModelBuilderTest. The test files are located in folder testData/actions/reformatFileInEditor.

Contributor guide