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 Rails.application.routes.url_helpers
|
||||||
include SharedMarkers
|
include SharedMarkers
|
||||||
|
|
||||||
def paragraph(text)
|
def paragraph(text) = "<p>#{text.gsub("\n", '<br>')}</p>"
|
||||||
"<p>#{text}</p>"
|
|
||||||
end
|
|
||||||
|
|
||||||
def link(link, _title, _content)
|
def link(link, _title, _content)
|
||||||
process_link(link)
|
process_link(link)
|
||||||
|
|
|
@ -74,6 +74,10 @@ describe MarkdownHelper, type: :helper do
|
||||||
it "should not process invalid links" do
|
it "should not process invalid links" do
|
||||||
expect(question_markdown("https://example.com/example.質問")).to eq("<p>https://example.com/example.質問</p>")
|
expect(question_markdown("https://example.com/example.質問")).to eq("<p>https://example.com/example.質問</p>")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should turn line breaks into <br> tags" do
|
||||||
|
expect(markdown("Some\ntext")).to eq("<p>Some<br>\ntext</p>")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#raw_markdown" do
|
describe "#raw_markdown" do
|
||||||
|
|
Loading…
Reference in New Issue