Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add leading+trailing line break to "Copy for Forum" content
Arduino IDE's "Edit > Copy for Forum (Markdown)" feature copies the contents of the currently selected editor tab to the clipboard, with "fenced code block" markup added to provide correct formatting when the content is posted to a platform supporting Markdown language such as Arduino Forum, GitHub, Stack Exchange, etc. One of the most common points of friction between the volunteer helpers on the forum and the newcomers requesting assistance is the failure to use the correct markup when posting code. In the best case scenario the code and thread is made less readable and less convenient to copy to the IDE for further investigation. Components of the code often resemble markup, which causes it to be corrupted by the forum's renderer. Even in cases where the user was conscientious enough to attempt to add the right markup, which is facilitated by tools such as "Copy for Forum (Markdown)", they often still don't get it quite right. So it is worthwhile to make efforts to make it less likely for the markup to be inadvertently invalidated. "Fenced code block" markup must be on its own lines before and after the code content. Someone not familiar with Markdown won't know this fact and may simply paste the content copied via "Copy for Forum (Markdown)" without manually adding a newline before and after. Since the code content is preceded and succeeded by a newline, they will not have any visual indication of a problem. Adding a newline before and after the content will ensure the markup is valid regardless of the context it is pasted into. In cases where the user did add a newline and this introduces a redundant line break in the forum post, it will not have any effect on the rendered content because the additional newlines are ignored by the renderer.
- Loading branch information