Skip to content

Commit ca9dfa0

Browse files
committed
feat: update docs
1 parent 6c17058 commit ca9dfa0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3036
-3976
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
"author": "Matt Levy",
3030
"license": "MIT",
3131
"devDependencies": {
32-
"cypress": "6.8.0",
32+
"cypress": "7.1.0",
3333
"http-server": "0.12.3",
3434
"npm-run-all": "4.1.5",
3535
"open-cli": "6.0.1",
3636
"replace-in-file": "6.2.0",
37-
"rollup": "2.44.0",
37+
"rollup": "2.45.2",
3838
"rollup-plugin-terser": "7.0.2",
3939
"standard": "16.0.3",
4040
"start-server-and-test": "1.12.1"

site/.eleventy.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight")
2+
const CleanCSS = require("clean-css")
3+
const htmlMinifier = require("html-minifier")
4+
const markdownIt = require('markdown-it')
5+
const slugify = require("slugify")
6+
const pluginTOC = require('eleventy-plugin-nesting-toc')
7+
const markdownItAnchor = require('markdown-it-anchor')
8+
const markdownItToc = require('markdown-it-table-of-contents')
9+
const markdownItEmoji = require('markdown-it-emoji')
10+
11+
module.exports = function(eleventyConfig) {
12+
eleventyConfig.addTransform("htmlmin", function(content, outputPath) {
13+
// Eleventy 1.0+: use this.inputPath and this.outputPath instead
14+
if (outputPath.endsWith(".html")) {
15+
let minified = htmlMinifier.minify(content, {
16+
useShortDoctype: true,
17+
removeComments: true,
18+
collapseWhitespace: true
19+
})
20+
return minified
21+
}
22+
return content
23+
})
24+
25+
eleventyConfig.addFilter("cssmin", function(code) {
26+
return new CleanCSS({}).minify(code).styles
27+
})
28+
29+
eleventyConfig.addShortcode("serviceWorker", function () {
30+
if (process.env.NODE_ENV === 'production') {
31+
return `<script>window.onload=function(){"serviceWorker"in navigator&&navigator.serviceWorker.register('/sw.js')};</script>`
32+
}
33+
return ''
34+
})
35+
36+
eleventyConfig.addPlugin(syntaxHighlight)
37+
38+
function removeExtraText(s) {
39+
let newStr = String(s).replace(/New\ in\ v\d+\.\d+\.\d+/, "")
40+
newStr = newStr.replace(/Coming\ soon\ in\ v\d+\.\d+\.\d+/, "")
41+
newStr = newStr.replace(//g, "")
42+
newStr = newStr.replace(/[?!]/g, "")
43+
newStr = newStr.replace(/<[^>]*>/g, "")
44+
return newStr;
45+
}
46+
47+
function markdownItSlugify(s) {
48+
return slugify(removeExtraText(s), { lower: true, remove: /[:'`,]/g })
49+
}
50+
51+
let mdIt = markdownIt({
52+
html: true,
53+
breaks: true
54+
})
55+
.use(markdownItAnchor, {
56+
permalink: true,
57+
slugify: markdownItSlugify,
58+
permalinkBefore: false,
59+
permalinkClass: "direct-link",
60+
permalinkSymbol: "",
61+
level: [1,2,3,4,5]
62+
})
63+
.use(markdownItToc, {
64+
includeLevel: [2, 3, 4, 5],
65+
slugify: markdownItSlugify,
66+
format: function(heading) {
67+
return removeExtraText(heading)
68+
},
69+
transformLink: function(link) {
70+
// remove backticks from markdown code
71+
return link.replace(/\%60/g, "")
72+
}
73+
})
74+
.use(markdownItEmoji);
75+
76+
eleventyConfig.setLibrary("md", mdIt)
77+
78+
eleventyConfig.addPlugin(pluginTOC, {
79+
tags: ['h2', 'h3', 'h4', 'h5'],
80+
wrapperClass: 'toc__nav',
81+
ul: true
82+
})
83+
}
File renamed without changes.

site/app/.eleventy.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

site/app/package.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)