abrookins / WrapToColumn

An IntelliJ plugin that wraps text
Apache License 2.0
62 stars 12 forks source link

Incorrect text wrapping on markdown-like text #18

Closed tomzx closed 3 years ago

tomzx commented 8 years ago

PHPStorm 10.0.2

I have the following (shorten) bit of text, which doesn't appear to wrap properly.

Given

Installation
============

Requirements
------------

After applying Wrap to column with a setting of 80, I get

Installation ============

Requirements ------------
abrookins commented 8 years ago

Thank you, @tomzx. I will look into this issue as soon as I can.

abrookins commented 8 years ago

Other interesting things about Markdown files: **Bold text** at the beginning of a line is interpreted as a comment, causing all lines afterward to gain a * prefix.

abrookins commented 8 years ago

FYI, I plan on tackling better Markdown support during October for Hacktoberfest.

abrookins commented 7 years ago

I started on this but ran out of time. It's my most desired feature, so I will resume after the holidays!

jflorian commented 6 years ago

I would like to see this handled better too. I use reST for my docstrings in PyCharm and have things like:

:param foo:   Does foo things.  See also *bar*.
:param bar:   Very different than *foo*.

The problem is that when markup like *foo* or *bar* gets near the wrap point, Wrap (Line) To Column has a tendency to strip off one or more of those asterisks. Sadly, I often don't notice until after commit/release. If I have to do much docstring work, I just resort to VIM which largely defeats the whole purpose.

lsaffre commented 5 years ago

Another example are dashed lists, i.e. paragraphs that start with "- " or "# " (a dash or hash followed by one or several spaces). In reStructuredText (and I guess in markdown as well) all remaining lines should have the same indentation as the first character of the first line (counting the "-" or "#" like a space).

gene1wood commented 5 years ago

Ya, using this with Markdown is challenging as lists don't wrap correctly

* List item 1
* List item 2 that's very very very very long

Becomes

* List item 1
* List item 2 that's very 
* very very very long
abrookins commented 5 years ago

The plugin needs some work on filetype-specific logic, which would help in a few of these areas. Some day I will add this. 😂

abrookins commented 3 years ago

Should be fixed in 1.7.0, now published to the Plugins Marketplace.

We now ignore most comment-like symbols in Markdown and AsciiDoc files, except for list symbols. If we find a list symbol, we'll wrap the text around it like this:

- Imagine this is a long line and 
  the plugin has wrapped it.