diff --git a/app/services/question_markdown.rb b/app/services/question_markdown.rb index 6ae585ea..6a251641 100644 --- a/app/services/question_markdown.rb +++ b/app/services/question_markdown.rb @@ -6,9 +6,7 @@ class QuestionMarkdown < Redcarpet::Render::StripDown include Rails.application.routes.url_helpers include SharedMarkers - def paragraph(text) - "

#{text}

" - end + def paragraph(text) = "

#{text.gsub("\n", '
')}

" def link(link, _title, _content) process_link(link) diff --git a/spec/helpers/markdown_helper_spec.rb b/spec/helpers/markdown_helper_spec.rb index e5f94884..b4c22b76 100644 --- a/spec/helpers/markdown_helper_spec.rb +++ b/spec/helpers/markdown_helper_spec.rb @@ -74,6 +74,10 @@ describe MarkdownHelper, type: :helper do it "should not process invalid links" do expect(question_markdown("https://example.com/example.質問")).to eq("

https://example.com/example.質問

") end + + it "should turn line breaks into
tags" do + expect(markdown("Some\ntext")).to eq("

Some
\ntext

") + end end describe "#raw_markdown" do