Hard wrap in question markdown
This commit is contained in:
parent
062ca6e65a
commit
9988527580
|
@ -6,9 +6,7 @@ class QuestionMarkdown < Redcarpet::Render::StripDown
|
|||
include Rails.application.routes.url_helpers
|
||||
include SharedMarkers
|
||||
|
||||
def paragraph(text)
|
||||
"<p>#{text}</p>"
|
||||
end
|
||||
def paragraph(text) = "<p>#{text.gsub("\n", '<br>')}</p>"
|
||||
|
||||
def link(link, _title, _content)
|
||||
process_link(link)
|
||||
|
|
|
@ -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("<p>https://example.com/example.質問</p>")
|
||||
end
|
||||
|
||||
it "should turn line breaks into <br> tags" do
|
||||
expect(markdown("Some\ntext")).to eq("<p>Some<br>\ntext</p>")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#raw_markdown" do
|
||||
|
|
Loading…
Reference in New Issue