Skip to content

Commit

Permalink
Render single quotes from markdown link text
Browse files Browse the repository at this point in the history
  • Loading branch information
rorJeremy committed Jan 22, 2019
1 parent 1d38b80 commit ffafe18
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Expand Up @@ -56,9 +56,9 @@ def markdown(text)
markdown = ::Redcarpet::Markdown.new(renderer, extensions)

content_tag(:div,
markdown.render(
remove_markdown_href_class_syntax(raw_classes, text)
).html_safe,
CGI.unescapeHTML(markdown.render(
remove_markdown_href_class_syntax(raw_classes, text)
)).html_safe,
class: 'formatted-content')
end

Expand Down
Expand Up @@ -23,13 +23,25 @@
'nothin to see here'
}

let(:markdown_link_with_quote) {
"[Children's](https://watermark.formstack.com/forms/childrensvolunteer)"
}

describe '#markdown' do
it 'returns string wrapped in div' do
rendered_html = helper.markdown(markdown_string_without_links)

expect(rendered_html).to have_selector('div.formatted-content')
end

context 'when markdown link text has a single quote in it' do
it 'renders the quote as a part of the link text' do
html_to_render = helper.markdown(markdown_link_with_quote)

expect(html_to_render).to have_content("Children's")
end
end

context 'when markdown includes links with classes' do
it 'uses those classes in the hyperlinks within the html to be rendered' do
html_to_render =
Expand Down

0 comments on commit ffafe18

Please sign in to comment.