From 39b11036cf5562e137736707fb9e2f8de5b78aae Mon Sep 17 00:00:00 2001 From: Muffin Date: Wed, 16 Aug 2023 23:09:00 -0500 Subject: [PATCH 1/5] Update docs styles --- development/docs-template.ejs | 71 +++++++++++++++++++++++++++++------ docs/CST1229/zip.md | 2 +- website/turbowarp.svg | 68 +++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 13 deletions(-) create mode 100644 website/turbowarp.svg diff --git a/development/docs-template.ejs b/development/docs-template.ejs index 5a31a49d5e..f9d0de94ee 100644 --- a/development/docs-template.ejs +++ b/development/docs-template.ejs @@ -13,7 +13,7 @@ @media (prefers-color-scheme: dark) { :root { color: #eee; - background: #111; + background: #131313; } } @@ -32,7 +32,37 @@ body { margin: 0; padding: 0; - border-top: 4px solid #ff4c4c; + line-height: 1.3; + } + + nav { + background-color: #ff4c4c; + color: white; + font-weight: bold; + font-size: 1.1em; + } + nav > * { + display: flex; + align-items: center; + max-width: 600px; + margin: 0 auto; + padding: 0.5rem 0.25rem; + gap: 0.5rem; + text-decoration: none; + color: inherit !important; + } + nav > *:hover { + text-decoration: underline; + } + nav img { + width: 2rem; + height: 2rem; + flex-shrink: 0; + } + @media (prefers-color-scheme: dark) { + nav { + background-color: #333; + } } noscript { @@ -42,13 +72,21 @@ .container { max-width: 600px; margin: auto; + padding: 0 0.25rem; + } + h1 { + font-size: 2.25rem; + } + h1, h2, h3, h4, h5, h6 { + border-bottom: 1px solid #ccc; } hr { border: none; border-top: 1px solid #ccc; + margin: 1rem 0; } @media (prefers-color-scheme: dark) { - hr { + hr, h1, h2, h3, h4, h5, h6 { border-color: #444; } } @@ -82,13 +120,20 @@ } footer { - margin: 16px 0; + margin: 1rem 0; font-size: small; } -
+ + +

<%- headerHTML %>

@@ -106,13 +151,15 @@

TurboWarp is not affiliated with Scratch, the Scratch Team, or the Scratch Foundation.

-
+ - - + <% if (usesScratchBlocks) { %> + + + <% } %> diff --git a/docs/CST1229/zip.md b/docs/CST1229/zip.md index 1d5cd49560..ef32c21961 100644 --- a/docs/CST1229/zip.md +++ b/docs/CST1229/zip.md @@ -14,7 +14,7 @@ Most blocks in this extension work with a path format: - A `/` at the end denotes a directory, like `folder/` - Multiple slashes in a row or trying to go above the root directory will result in an error (usually the block doing nothing or returning the empty value) -## Archive management blocks (link) +## Archive management blocks Blocks for creating and saving the current archive. Only one archive can be open at a time. diff --git a/website/turbowarp.svg b/website/turbowarp.svg new file mode 100644 index 0000000000..6a1ec7f87d --- /dev/null +++ b/website/turbowarp.svg @@ -0,0 +1,68 @@ + + From 3a3afecca3e0588b286afd50c9f0bb6c202258a5 Mon Sep 17 00:00:00 2001 From: Muffin Date: Wed, 16 Aug 2023 23:12:37 -0500 Subject: [PATCH 2/5] Downgrade scratchblocks until https://github.com/scratchblocks/scratchblocks/pull/488 is merged --- development/builder.js | 2 +- package-lock.json | 10 +++++----- package.json | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/development/builder.js b/development/builder.js index 7b03ff6e22..422c108056 100644 --- a/development/builder.js +++ b/development/builder.js @@ -237,7 +237,7 @@ class Builder { build.files[`/${extensionId}.html`] = new DocsFile(path); } - const scratchblocksPath = pathUtil.join(__dirname, '../node_modules/@turbowarp/scratchblocks/build/scratchblocks.min.js'); + const scratchblocksPath = pathUtil.join(__dirname, '../node_modules/scratchblocks/build/scratchblocks.min.js'); build.files['/docs-internal/scratchblocks.js'] = new DiskFile(scratchblocksPath); const extensionFiles = []; diff --git a/package-lock.json b/package-lock.json index aaef705921..d7fafffc5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -131,11 +131,6 @@ "fastq": "^1.6.0" } }, - "@turbowarp/scratchblocks": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/@turbowarp/scratchblocks/-/scratchblocks-3.6.3.tgz", - "integrity": "sha512-KhP30VjqXfeY5Zlyts+uRM1js6J2gQyKzW7kHICvI1hGs808m85EYTTYkmNxRwYjdE9cCapeLy8Xf7IHr4lcuQ==" - }, "@turbowarp/types": { "version": "git+https://github.com/TurboWarp/types-tw.git#d62df1559786c318f22148919cde69a3e74f8f34", "from": "git+https://github.com/TurboWarp/types-tw.git#tw" @@ -1248,6 +1243,11 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "scratchblocks": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/scratchblocks/-/scratchblocks-3.6.2.tgz", + "integrity": "sha512-qiBGgolVBNlhR8QfDu/XA4LxRIPr0KD3BYLaRT238SjdRwalJwMMygaaLHQgJ4FiGgRK8gPHqoto/i1BYLs7nw==" + }, "send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", diff --git a/package.json b/package.json index b1b69d48dd..ca6eddd773 100644 --- a/package.json +++ b/package.json @@ -20,13 +20,13 @@ }, "homepage": "https://github.com/TurboWarp/extensions#readme", "dependencies": { - "@turbowarp/scratchblocks": "^3.6.3", "@turbowarp/types": "git+https://github.com/TurboWarp/types-tw.git#tw", "chokidar": "^3.5.3", "ejs": "^3.1.9", "express": "^4.18.2", "image-size": "^1.0.2", - "markdown-it": "^13.0.1" + "markdown-it": "^13.0.1", + "scratchblocks": "^3.6.2" }, "devDependencies": { "eslint": "^8.47.0" From 82240809db685378bb0ba7e1b21da09679ebc35c Mon Sep 17 00:00:00 2001 From: Muffin Date: Wed, 16 Aug 2023 23:17:16 -0500 Subject: [PATCH 3/5] Add canonical links to help search engines deduplicate --- development/builder.js | 7 ++++--- development/docs-template.ejs | 1 + development/render-docs.js | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/development/builder.js b/development/builder.js index 422c108056..a5613ecee1 100644 --- a/development/builder.js +++ b/development/builder.js @@ -145,14 +145,15 @@ IMAGE_FORMATS.set('.jpg', ImageFile); IMAGE_FORMATS.set('.svg', SVGFile); class DocsFile extends DiskFile { - constructor (path) { + constructor (path, extensionId) { super(path); + this.extensionId = extensionId; this.getDiskPath = null; } read () { const markdown = super.read().toString('utf-8'); - return renderDocs(markdown); + return renderDocs(markdown, this.extensionId); } getType () { @@ -234,7 +235,7 @@ class Builder { continue; } const extensionId = docsFilename.split('.')[0]; - build.files[`/${extensionId}.html`] = new DocsFile(path); + build.files[`/${extensionId}.html`] = new DocsFile(path, extensionId); } const scratchblocksPath = pathUtil.join(__dirname, '../node_modules/scratchblocks/build/scratchblocks.min.js'); diff --git a/development/docs-template.ejs b/development/docs-template.ejs index f9d0de94ee..e2510f93b6 100644 --- a/development/docs-template.ejs +++ b/development/docs-template.ejs @@ -4,6 +4,7 @@ <%= headerText %> - TurboWarp Extension Documentation +