taqueci / redmine_wysiwyg_editor

Redmine WYSIWYG Editor plugin
GNU General Public License v2.0
114 stars 27 forks source link

Broken markdown tables when using block macros #90

Open dinya opened 4 years ago

dinya commented 4 years ago

When I use "block" macros in Markdown tables the redmine_wysiwyg_editor brokes the render.

For example let's create the markdown table (I used {{collapse}} and {{mj}} block macros, but I think there are the same problem with another ones)

Inline | Block
-------|------
Simple text | {{collapse(Hidden part)

a | b
---|---
1 | 2

}}
{{thumbnail(redmine_logo_v1.png, width=500)}} | {{mj

\begin{align}
    \cos^2 \phi + \sin^2 \phi = 1 \\
    e^{i \phi} = \cos\phi + i\sin\phi
\end{align}

}}

The table should be renderes in the "clean" Redmine as

image1

If I try to paste the above markdown code to "Markdown" tab of redmine_wysiwyg_editor and then click on "Visual editor" tab the result will be as follows

image2

but "Preview" tab content is still the same as for "clean" Redmine.

But if I try to add "Some text" in "Visual editor" then the contents of "Markdown" and "Preview" tabs will fail. For example "Markdown" tab content will become:

| Inline | Block |
| --- | --- |
| Simple text | {{collapse(Hidden part) |
| a | b |
| --- | --- |
| 1 | 2 |

}}
{{thumbnail(redmine_logo_v1.png, width=500)}} | {{mj

\begin{align}
\cos<sup>2</sup> \phi + \sin<sup>2</sup> \phi = 1 \
e<sup>{i</sup> \phi} = \cos\phi + i\sin\phi
\end{align}

}}

Some text

P.S. redmine_wysiwyg_editor replaces hats ^x with <sup>x</sup>.

I tested with:

  1. Redmine 3.4.11 (but I think the same problem exists in 4.x too)
  2. Last master redmine_wysiwyg_editor (v0.15.3)