markdown-mode icon indicating copy to clipboard operation
markdown-mode copied to clipboard

`markdown-toggle-markup-hiding` misaligns tables in `gfm-mode`

Open matthew-piziak opened this issue 6 years ago • 3 comments

Expected Behavior

When gfm-mode is active, markdown-toggle-markup-hiding should render tables or at least keep columns aligned.

Actual Behavior

If the contents of the tables change their width when markdown-toggle-markup-hiding is invoked, then the table becomes misaligned.

Steps to Reproduce

In gfm-mode input the following table.

| Foo   | Bar   |
|-------|-------|
| `foo` | `bar` |
| `foo` | baz   |

Note that in normal viewing it is aligned.

image

Invoke markdown-toggle-markup-hiding, and note that it now becomes misaligned.

image

Software Versions

Markdown Mode 20180124.138 GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.26) of 2018-02-12 Arch Linux

Remarks

I am aware that this is a tall request, but I felt that it should at least be documented.

matthew-piziak avatar Apr 03 '18 15:04 matthew-piziak

This is already documented in README:

The table editing functions try to handle markup hiding correctly when calculating column widths, however, columns containing hidden markup may not always be aligned properly.

You may see the discussion in #266 for some technical details concerning this behavior.

saf-dmitry avatar Apr 04 '18 06:04 saf-dmitry

@saf-dmitry For text in a table, do you think it would work if we set the display property to " " (a space) instead of setting the invisible property?

jrblevin avatar Jun 15 '18 19:06 jrblevin

@jrblevin Nice idea, but this can result in an ugly layout, e.g. markup hiding will turn the following table cells

| [Link](www.example.com) | **foo**, *bar* |

into this

|  Link                   |   foo  ,  bar  |

saf-dmitry avatar Jun 20 '18 13:06 saf-dmitry