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

Author in header leads to wrong re-formatting #314

Closed
ahus1 opened this issue Aug 6, 2019 · 6 comments
Closed

Author in header leads to wrong re-formatting #314

ahus1 opened this issue Aug 6, 2019 · 6 comments
Labels

Comments

@ahus1
Copy link
Contributor

ahus1 commented Aug 6, 2019

When adding author and version information to the header of the document, the reformatting scrambles it: it adds an empty line just before the author. Attributes get wrapped to a single line instead of staying in one line.

The plugin should leave the author just below the title. The attributes should stay in their own lines.

= Title
Writer <doc.writer@example.com> v0.1, 2019-01-01
:toc: left
:icons: font

AsciiDoc Plugin Version: 0.28.27

(thanks for @luvarqpp for reporting this)

@ahus1 ahus1 added the bug label Aug 6, 2019
@ahus1
Copy link
Contributor Author

ahus1 commented Aug 6, 2019

A first analysis shows that the author information is recognized as normal text by the lexer. This leads in the following to treating the attribute definitions as plain text, too, as attributes must not appear within a text block.

A workaround is to not use the author information or not to use reformatting until this is fixed.

A user can disable reformatting for AsciiDoc by disabling the checkbox "Settings..." | "Editor" | "Code Style" | "AsciiDoc" | "Enable Formatting".

@ahus1
Copy link
Contributor Author

ahus1 commented Aug 7, 2019

@luvarqpp - a new preview release 0.29.2 is available that is handling author information and following attribute declarations correctly: it will no longer word-wrap them.

The pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.

Please give it a try and comment in this ticket if the pre-releases solves the issue for you. Thanks!

@luvarqpp
Copy link

luvarqpp commented Aug 8, 2019

@ahus1 thanks, I can confirm that given plugin build is OK in term of formatting author part of document.

Another "magic" has happened through. I have some longer lines (200 and more characters) and I use soft-wrap (sidenote, plugin does not save soft-wrap setting during IDE restarts). After making "code" formatted by plugin (ctrl+alt+L Reformat code, on directory with documents), one line has been split to three lines. Each line after splitting contained single sentence.

I consider given behavior as weird, because the other lines did not get split. Given the single line which has been split has some words in backquote/backtick and it was between two "operation" macro from spring-restdocs-asciidoctor extension (which is in .ascidoctor folder as mentioned in #310 issue).

@ahus1
Copy link
Contributor Author

ahus1 commented Aug 8, 2019

@luvarqpp - thanks for giving this release a try.

The one-sentence-per-line is one of the patterns considered an asciidoc best practice. It allows moving around sentences easily, editing the sentence provides you with a meaningful diff view (compared to wordwrap).
Having one line per sentence instead of a whole paragraph keeps the git "annotate" useful to find out who changed what and why.

Having said that this feature can be disabled and enabled separately in the code style settings for asciidoc.

If you have a demo snipped showing some text that was split into two lines but shouldn't, please post it in this ticket. I can the amend the rules.

To make wrapping permanent: there is a general IntelliJ setting that allows you to change to wordwrap for a set of file extensions. The plugin could have given a hint for this I suppose.

@luvarqpp
Copy link

luvarqpp commented Aug 8, 2019

@ahus1 - you answered all my questions...
I will give it a try (one sentence per line).
Thanks. You can imho close this issue.

@ahus1
Copy link
Contributor Author

ahus1 commented Aug 8, 2019

@luvarqpp - thank for sharing you experiences. I created to tickets to enhance the UX to learn about conventions and feature "as you go".

As the original bug is now fixed, I close this ticket.

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