Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code font sizing #131

Merged
merged 2 commits into from
Oct 21, 2019
Merged
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
35 changes: 35 additions & 0 deletions example/source/code.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Code examples
---

# Code examples

A paragraph with a `code` element within it.

<a href="#"><code>code element within a link</code></a>

An example of a code block with a long line length

```ruby
RSpec.describe ContentItem do
subject { described_class.new(base_path) }
let(:base_path) { "/search/news-and-communications" }
let(:finder_content_item) { news_and_communications }
let(:news_and_communications) {
JSON.parse(File.read(Rails.root.join("features", "fixtures", "news_and_communications.json")))
}

RSpec.describe "as_hash" do
it "returns a content item as a hash" do
expect(subject.as_hash).to eql(finder_content_item)
end
end
end
```

An example of a code block with a short length

```ruby
RSpec.describe ContentItem do
end
```
2 changes: 0 additions & 2 deletions example/source/index.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ If you want slightly more control, you can always use <strong>HTML</strong>.
For more detail and troubleshooting, take a look at the `README.md` file in the root of this project.

<%= warning_text "Look out! A warning!" %>

<a href="#"><code>code element within a link</code></a>
9 changes: 9 additions & 0 deletions lib/assets/stylesheets/modules/_technical-documentation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@
border-left: govuk-spacing(2) solid govuk-colour("mid-grey");
}

// http://code.iamkate.com/html-and-css/fixing-browsers-broken-monospace-font-handling/
pre,
code {
// Restores the normal text size in Mozilla Firefox, Google Chrome, and Safari; this unusual style rule should also be used anywhere where you would otherwise set the font-family property to ‘monospace’.
font-family: monospace, monospace;
// Restores the normal text size in Internet Explorer and Opera.
font-size: 1em;
}

pre {
background: $code-00;
padding: 15px;
Expand Down