TinyMCE code indentation issue

104 Views Asked by At

I have integrated TinyMCE with rails 4.2.6 through cdn. Also I am using it's "codesample" plugin. Everything is working fine except when I add code and update the post. The code indentation messess up on the show page. I have used prismJS and prism.css files also. I am attaching the screenshot of show page that how the indentation is messing up. enter image description here

1

There are 1 best solutions below

0
On

I wasn't able to solve this issue but for now I discovered a workaround. TinyMCE produces the below code when I write a code inside it. This causes the indentation to break on my show page(I have no clue why)

<pre class="language-ruby"><code>def hello
  "Hello"
end</code></pre>

So to avoid the indentation issue I modified the above code with the below one.

<pre class="language-ruby"><code>
def hello
  "Hello"
end
</code></pre>

Attached screenshot below: enter image description here