Rails & SimpleMDE - 内容显示缩进

Rails & SimpleMDE - content displays indented

我已经在我的 rails 应用程序上安装了 SimpleMDE,用于创建帖子的文本区域。我遇到的问题是当我想编辑 post.body 的内容时(即具有 simplemde 的文本区域)看起来像您在屏幕截图上看到的那样缩进:

我查看了 show action 的源代码,以防它生成一些额外的标签,但 markdown 看起来不错

这让我觉得是编辑器出了问题。如何修复编辑器上显示的缩进?

这也是我的代码

# The gemfile
gem 'simplemde', '~> 0.1.0'
gem 'redcarpet', '~> 3.4'
# gem 'html-pipeline', '~> 2.5'
# gem 'github-markdown', '~> 0.6.9'
# gem 'sanitize', '~> 4.4'

# the _form.html.haml file
= f.input :body, as: :text, input_html: { class: 'simplemde' }

# the coffescript file
simplemde = null
$(document).on 'turbolinks:before-visit', ->
  if simplemde?
    simplemde.toTextArea()
    simplemde = null

$(document).on 'turbolinks:load', ->
  simplemde = new SimpleMDE(element: $('.simplemde')[0])

我找到了解决方案,所以我将post放在这里以防万一其他人需要它。

https://github.com/NextStepWebs/simplemde-markdown-editor/issues/480

基本上所有需要做的就是替换

= f.input :body

~ f.input :body # notice the tilde symbol

这会解决所有问题。

但是,如果有更好的解决方案,我将不胜感激 post。