Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.bundle/
/.yardoc
/.idea/
/_yardoc/
/coverage/
/doc/
Expand Down
8 changes: 8 additions & 0 deletions lib/govuk_markdown/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ def hrule
HTML
end

def block_quote(content)
<<~HTML
<blockquote class="govuk-inset-text">
#{content.strip}
</blockquote>
HTML
end

def preprocess(document)
Preprocessor
.new(document)
Expand Down
29 changes: 25 additions & 4 deletions spec/govuk_markdown_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,31 @@
)
end

it "renders links with titles with GOV.UK classes" do
expect(render('[GOV.UK homepage](https://www.gov.uk "My title")')).to eq(
'<p class="govuk-body-m"><a href="https://www.gov.uk" title="My title" class="govuk-link">GOV.UK homepage</a></p>',
)
it "renders blockquotes with GOV.UK classes" do
input = <<~MARKDOWN
> You quoted me!
MARKDOWN
expected = <<~HTML
<blockquote class="govuk-inset-text">
<p class="govuk-body-m">You quoted me!</p>
</blockquote>
HTML
expect(render(input)).to eq(expected.strip)
end

it "renders blockquotes with multiple paragraphs and GOV.UK classes" do
input = <<~MARKDOWN
> You quoted me once,
>
> you should do it again!
MARKDOWN
expected = <<~HTML
<blockquote class="govuk-inset-text">
<p class="govuk-body-m">You quoted me once,</p>
<p class="govuk-body-m">you should do it again!</p>
</blockquote>
HTML
expect(render(input)).to eq(expected.strip)
end

it "renders hrules with GOV.UK classes" do
Expand Down