Home > Net >  How do I prevent the Reformat Code action for Markdown files from putting a full stop on a line of i
How do I prevent the Reformat Code action for Markdown files from putting a full stop on a line of i

Time:01-10

I find that the "Reformat Code" action in IntelliJ (and, by extension, Android Studio) will put a full stop on a new line in Markdown files if the full stop is the character at the "Hand wrap at" limit.

For example, take the following two lines:

Screenshot of code before applying the Reformat Code action

The full stop on line 13 is the only character past the "Hand wrap at" limit. If I apply the Reformat Code action with all the default Code Style settings for Markdown files, the full stop (and only the full stop) will be moved to a new line, as follows:

Screenshot of code after applying the Reformat Code action

This means that a space will be placed between the full stop and the word before it when the Markdown file is rendered. That is incorrect. It would be better if the Reformat Code action kept the full stop on line 13 or moved the full stop to a new line together with the word that precedes it.

Is there any Code Style setting for Markdown files which will prevent the Reformat Code action from moving the full stop to a line of its own? Or is adding Markdown files to the "Do not format" list the only way to prevent this?

CodePudding user response:

The issue described in my question is a bug in older versions of IntelliJ. See Screenshot of code after applying the Reformat Code action

  • Related