Skip to content

Commit

Permalink
Merge pull request #360 from primer/code_padding
Browse files Browse the repository at this point in the history
Removing ::before ::after padding hack on markdown
  • Loading branch information
jonrohan authored Nov 8, 2017
2 parents 5cf4b24 + 607ce88 commit 8c06f60
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
19 changes: 3 additions & 16 deletions modules/primer-markdown/lib/code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@
// Inline code snippets
code,
tt {
padding: 0;
padding-top: 0.2em;
padding-bottom: 0.2em;
padding: 0.2em 0.4em;
margin: 0;
font-size: 85%;
background-color: rgba($black, 0.05);
border-radius: 3px; // don't add padding, gives scrollbars

&::before,
&::after {
letter-spacing: -0.2em; // this creates padding
content: "\00a0";
}
border-radius: $border-radius;

br { display: none; }
}
Expand Down Expand Up @@ -53,7 +45,7 @@
font-size: 85%;
line-height: 1.45;
background-color: $gray-100;
border-radius: 3px;
border-radius: $border-radius;
}

pre code,
Expand All @@ -67,10 +59,5 @@
word-wrap: normal;
background-color: transparent;
border: 0;

&::before,
&::after {
content: normal;
}
}
}
18 changes: 18 additions & 0 deletions modules/primer-markdown/stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import { storiesOf } from '@storybook/react'

storiesOf('Markdown', module)
.add('code', () => (
<div className="markdown-body">
<p>
This is inline <code>code block</code>. This <code>code block has a &lt;br&gt;<br/> in it</code>. <code>When a code block has a long sentence in it, it should wrap the page to a new line</code>. Some people like to see the world burn and put <code>reallylongunbrokenstringsreallylongunbrokenstringsreallylongunbrokenstringsreallylongunbrokenstringsreallylongunbrokenstrings</code> in the code blocks.
</p>
</div>
))
.add('pre', () => (
<div className="markdown-body">
<pre>
<code>Really long pre blocks should scroll horizontally when the words are longer than the parent container</code>
</pre>
</div>
))

0 comments on commit 8c06f60

Please sign in to comment.