私は初めてshowdown-rails
gemを使用していますが、表示に問題があります。私はapplication.js
ファイルに//= require showdown
というファイルを含め、GitHubページの指示に従って宝石のインストールを行った。Rails Appにショーダウンが表示されない
<%= form_for(@wiki) do |f| %>
<%= f.label :title %><br>
<%= f.text_field :title, class: "form-control" %>
<%= f.label :body %><br>
<%= f.text_area :body, class: "form-control", style: "height: 250px", id: "wiki_body" %>
<% if current_user.admin? || current_user.premium? %>
<%= f.label :private, class: 'checkbox' do %>
<%= f.check_box :private %> Make Wiki Private
<% end %>
<% end %>
<% if @wiki.private? %>
<%= f.label "Add Collaborators", class: 'checkbox' %>
<div style="height: 80px; overflow: scroll; border: thin grey solid; padding-left: 10px">
<% @users.each do |user| %>
<%= check_box_tag "wiki[user_ids][]", user.id, @wiki.users.include?(user) %>
<%= user.name %><br>
<% end %>
</div>
<% end %>
<script>
var converter = new showdown.Converter();
$('#wiki_body').on('keyup', function() {
var mdown = $(this).val();
$('#wiki_preview').html(converter.makeHtml(mdown));
});
</script>
<div class="well" style="margin-top: 20px">
<p id="wiki_preview"></p>
</div> <!-- showdown well -->
<div class="text-center">
<%= f.submit "Create Wiki", class: "btn-custom" %>
</div> <!-- text-center -->
<% end %>
井戸が表示されますが、実際のテキストShowdown
は表示されませんレンダリングする必要があります:私は、次のコードを使用して、私のwikis#edit
/wikis#new
ページ上の一部の_form
でそれを使用しています。これは私の初めての宝石の使い方なので、どこが間違っているのか分かりません。誰も私のエラーをここで指摘できますか?