Skip to content

Commit 697b318

Browse files
authored
Merge pull request blocks#110 from blocks/docs-syntax-highlighting
docs: Add syntax highlighting + update sidebar slightly
2 parents b303391 + 126ad92 commit 697b318

File tree

5 files changed

+50
-21
lines changed

5 files changed

+50
-21
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@mdx-js/react": "1.5.1",
3333
"@theme-ui/components": "0.2.49",
3434
"@theme-ui/presets": "0.2.44",
35+
"@theme-ui/prism": "^0.2.46",
3536
"gatsby-plugin-catch-links": "2.1.17",
3637
"gatsby-plugin-compile-es6-packages": "2.1.0",
3738
"gatsby-plugin-fathom": "1.1.0",

src/components/layout.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -126,32 +126,32 @@ export default ({ children, _frontmatter: { title, noNav } = {} }) => (
126126
sx={{
127127
gridArea: 'nav',
128128
px: 3,
129-
py: [3, 4, 4],
130-
mt: '10px',
129+
pt: [3, 4],
131130
ul: {
132131
listStyle: 'none',
133-
p: 0
132+
p: 0,
133+
m: 0,
134+
mt: [0, '10px']
134135
},
135136
li: {
136-
mb: 1,
137-
fontSize: 1,
138-
ul: {
139-
li: {
140-
mb: 0
141-
},
142-
pl: 2,
143-
a: {
144-
fontWeight: 400,
145-
color: '#2f353b'
146-
}
137+
fontSize: 2,
138+
fontWeight: 'bold',
139+
mb: 2,
140+
'& ul': {
141+
ml: 2,
142+
mt: 2,
143+
mb: 3
147144
},
148-
a: {
149-
color: 'black',
150-
fontWeight: 500,
151-
textDecoration: 'none',
152-
'&:hover': {
153-
color: 'black'
154-
}
145+
'& li': {
146+
fontWeight: 'normal',
147+
mb: 0
148+
}
149+
},
150+
a: {
151+
color: 'inherit',
152+
textDecoration: 'none',
153+
'&:hover, &:focus': {
154+
color: 'primary'
155155
}
156156
}
157157
}}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Prism from '@theme-ui/prism'
2+
3+
export default {
4+
pre: props => props.children,
5+
code: Prism
6+
}

src/gatsby-plugin-theme-ui/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { system } from '@theme-ui/presets'
2+
import prism from '@theme-ui/prism/presets/theme-ui'
23

34
const theme = {
45
...system,
@@ -13,6 +14,12 @@ const theme = {
1314
},
1415
styles: {
1516
...system.styles,
17+
h1: {
18+
...system.styles.h1,
19+
'&:first-child': {
20+
mt: 0
21+
}
22+
},
1623
navLink: {
1724
color: 'inherit',
1825
textDecoration: 'none',
@@ -27,6 +34,9 @@ const theme = {
2734
},
2835
img: {
2936
maxWidth: '100%'
37+
},
38+
code: {
39+
...prism
3040
}
3141
},
3242
buttons: {

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,6 +2315,13 @@
23152315
"@theme-ui/preset-tailwind" "^0.2.42"
23162316
"@theme-ui/preset-tosh" "^0.2.40"
23172317

2318+
"@theme-ui/prism@^0.2.46":
2319+
version "0.2.46"
2320+
resolved "https://registry.yarnpkg.com/@theme-ui/prism/-/prism-0.2.46.tgz#8a8afff768149a687feeca2fae630b2fbf557bf0"
2321+
integrity sha512-CGkM/jw8gmXjuDyWf0TeBqxXfgkx69YMVzV9/y78GMD8OoO36izfCtj3KNyE8ENq7OyNS5atj+u/WY30KIiu/w==
2322+
dependencies:
2323+
prism-react-renderer "^1.0.2"
2324+
23182325
"@theme-ui/style-guide@^0.2.49":
23192326
version "0.2.49"
23202327
resolved "https://registry.yarnpkg.com/@theme-ui/style-guide/-/style-guide-0.2.49.tgz#757811bebc37c4f8b20635fa0f903f718ad86c11"
@@ -12230,6 +12237,11 @@ pretty-format@^24.9.0:
1223012237
ansi-styles "^3.2.0"
1223112238
react-is "^16.8.4"
1223212239

12240+
prism-react-renderer@^1.0.2:
12241+
version "1.0.2"
12242+
resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.0.2.tgz#3bb9a6a42f76fc049b03266298c7068fdd4b7ea9"
12243+
integrity sha512-0++pJyRfu4v2OxI/Us/5RLui9ESDkTiLkVCtKuPZYdpB8UQWJpnJQhPrWab053XtsKW3oM0sD69uJ6N9exm1Ag==
12244+
1223312245
private@^0.1.6:
1223412246
version "0.1.8"
1223512247
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"

0 commit comments

Comments
 (0)