Skip to content

Commit a2f2c5b

Browse files
committed
Add syntax highlighting
1 parent d3f5350 commit a2f2c5b

File tree

8 files changed

+307
-77
lines changed

8 files changed

+307
-77
lines changed

.eleventy.js

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
const { buildSrc, buildDest } = require('./paths');
1+
const { buildSrc, buildDest } = require("./paths");
22
const markdownIt = require("markdown-it");
3-
const markdownItResponsive = require('@gerhobbelt/markdown-it-responsive');
3+
const markdownItResponsive = require("@gerhobbelt/markdown-it-responsive");
44
const pluginRss = require("@11ty/eleventy-plugin-rss");
5+
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
56

6-
const filters = require('./utils/filters.js');
7-
const collections = require('./utils/collections.js');
8-
const shortcodes = require('./utils/shortcodes.js');
7+
const filters = require("./utils/filters.js");
8+
const collections = require("./utils/collections.js");
9+
const shortcodes = require("./utils/shortcodes.js");
910

1011
module.exports = function (eleventyConfig) {
11-
1212
// Plugins
1313
eleventyConfig.addPlugin(pluginRss);
14+
eleventyConfig.addPlugin(pluginSyntaxHighlight);
1415

1516
// Filters
1617
Object.keys(filters).forEach((filterName) => {
@@ -28,10 +29,10 @@ module.exports = function (eleventyConfig) {
2829
});
2930

3031
// Watch assets folder for changes
31-
eleventyConfig.addWatchTarget('./src/_assets');
32+
eleventyConfig.addWatchTarget("./src/_assets");
3233

3334
// Copy these assets straight across
34-
eleventyConfig.addPassthroughCopy({'./src/_assets/svg': '_assets/svg'});
35+
eleventyConfig.addPassthroughCopy({ "./src/_assets/svg": "_assets/svg" });
3536

3637
// Alias these layouts
3738
eleventyConfig.addLayoutAlias("default", "layouts/base.njk");
@@ -47,26 +48,32 @@ module.exports = function (eleventyConfig) {
4748

4849
const rwdOptions = {
4950
responsive: {
50-
'srcset': {
51-
'*': [ {
52-
width: 320,
53-
rename: {
54-
suffix: '-320'
55-
}
56-
}, {
57-
width: 550,
58-
rename: {
59-
suffix: '-550'
60-
}
61-
} ]
51+
srcset: {
52+
"*": [
53+
{
54+
width: 320,
55+
rename: {
56+
suffix: "-320",
57+
},
58+
},
59+
{
60+
width: 550,
61+
rename: {
62+
suffix: "-550",
63+
},
64+
},
65+
],
66+
},
67+
sizes: {
68+
"*": "(max-width: 550px) calc(100vw - 120px), 550px",
6269
},
63-
'sizes': {
64-
'*': '(max-width: 550px) calc(100vw - 120px), 550px'
65-
}
66-
}
70+
},
6771
};
6872

69-
eleventyConfig.setLibrary("md", markdownIt(options).use(markdownItResponsive, rwdOptions));
73+
eleventyConfig.setLibrary(
74+
"md",
75+
markdownIt(options).use(markdownItResponsive, rwdOptions)
76+
);
7077

7178
eleventyConfig.setDataDeepMerge(true);
7279

@@ -81,7 +88,7 @@ module.exports = function (eleventyConfig) {
8188
input: `${buildSrc}`,
8289
output: buildDest,
8390
data: "_data",
84-
includes: "_includes"
91+
includes: "_includes",
8592
},
8693
};
8794
};

package-lock.json

Lines changed: 67 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@
2727
"svg-sprite": "^1.5.0",
2828
"url-slug": "^2.3.1",
2929
"webpack": "^4.43.0"
30+
},
31+
"devDependencies": {
32+
"@11ty/eleventy-plugin-syntaxhighlight": "^3.0.1"
3033
}
3134
}

src/_assets/scss/main.scss

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ $vandaTeal: #0089a1;
88
$lincolnGreen: #afb302;
99
$sparksBlack: #000000;
1010

11-
@import url('https://fonts.googleapis.com/css?family=Space+Mono:400,700');
11+
@import url("https://fonts.googleapis.com/css?family=Space+Mono:400,700");
1212

13-
html, body {
14-
font-family: 'Space Mono', monospace;
13+
html,
14+
body {
15+
font-family: "Space Mono", monospace;
1516
font-size: 100%;
1617
margin: 0;
1718
padding: 0;
1819
}
1920

2021
.avatar {
21-
background: url('/_assets/img/james.png') no-repeat bottom right;
22+
background: url("/_assets/img/james.png") no-repeat bottom right;
2223
background-size: 100%;
2324
bottom: 0;
2425
height: 0;
@@ -35,7 +36,7 @@ body {
3536

3637
section {
3738
border-radius: 4px;
38-
box-shadow: 0 0 40px 10px rgba(206,206,206,0.50);
39+
box-shadow: 0 0 40px 10px rgba(206, 206, 206, 0.5);
3940
margin: 20px;
4041
min-height: calc(100vh - 120px);
4142
padding: 40px;
@@ -55,20 +56,22 @@ h1 {
5556
padding: 0;
5657

5758
&:before {
58-
content: '/';
59+
content: "/";
5960
}
6061

6162
&:after {
6263
color: $themeGreen;
63-
content: '_';
64+
content: "_";
6465
}
6566

6667
@media (min-width: 485px) {
6768
font-size: 3em;
6869
}
6970
}
7071

71-
li, p, code {
72+
li,
73+
p,
74+
code {
7275
font-size: 1em;
7376
line-height: 1.45em;
7477
margin: 0 0 1em;
@@ -96,7 +99,7 @@ a {
9699
color: black;
97100
outline: none;
98101
text-decoration: none;
99-
transition: color .25s, border .25s;
102+
transition: color 0.25s, border 0.25s;
100103

101104
&:hover {
102105
border-bottom-color: black;
@@ -117,7 +120,7 @@ blockquote {
117120
padding: 10px 0;
118121

119122
a:before {
120-
content: '/';
123+
content: "/";
121124
}
122125
}
123126

@@ -141,11 +144,13 @@ hr {
141144
margin-bottom: 1em;
142145
}
143146

144-
@import 'homepage';
145-
@import 'thoughts';
146-
@import 'listing';
147-
@import 'btn';
148-
@import 'shopLinks';
149-
@import 'boxedMessage';
150-
@import 'embedWrapper';
151-
@import 'nowList';
147+
@import "homepage";
148+
@import "thoughts";
149+
@import "listing";
150+
@import "btn";
151+
@import "shopLinks";
152+
@import "boxedMessage";
153+
@import "embedWrapper";
154+
@import "nowList";
155+
156+
@import "prism";

0 commit comments

Comments
 (0)