From d07c1709cf6fe8cff656a55d24cf26608ae0302f Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Wed, 20 Dec 2023 00:40:35 +0000 Subject: [PATCH] ....turns out there *is* a GH alert markdown-it plugin! Thanks, markdown-it-github-alerts :D A bit of CSS ~~hackery~~ magic and we're away! --- .docs/css/theme.css | 28 ++++++++++++++++++++++++++-- .docs/lib/parse_sections.js | 3 +++ .docs/package-lock.json | 22 ++++++++++++++++++++-- .docs/package.json | 1 + 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/.docs/css/theme.css b/.docs/css/theme.css index d4795f1..f66ee57 100644 --- a/.docs/css/theme.css +++ b/.docs/css/theme.css @@ -442,26 +442,50 @@ footer { border: 0.2em solid var(--cat-colour); } -.note, .tip, .important, .warning, .caution { +.note, .tip, .important, .warning, .caution +.markdown-alert-note, +.markdown-alert-tip, +.markdown-alert-important, +.markdown-alert-warning, +.markdown-alert-caution +{ padding: 0.4em 0.6em; border-radius: 0 0.2em 0.2em 0; } +.markdown-alert-note::before, .note::before { color: #31a0fc; content: "\0024d8\0000a0Note"; } +.markdown-alert-tip::before, .tip::before { color: #25cb1c; content: "\01f4a1\0000a0Tip"; } -.important::before { color: #911ccb; content: "\01f53a\0000a0Important"; } +.markdown-alert-important::before, +.important::before { color: #911ccb; content: "\01f7e3\0000a0Important"; } +.markdown-alert-warning::before, .warning::before { color: #e0b840; content: "\0026a0\0000a0Warning"; } +.markdown-alert-caution::before, .caution::before { color: #e04040; content: "\00203c\0000a0Caution"; } + +.markdown-alert-note::before, +.markdown-alert-tip::before, +.markdown-alert-important::before, +.markdown-alert-warning::before, +.markdown-alert-caution::before, .note::before, .tip::before, .important::before, .warning::before, .caution::before { display: block; font-weight: bold; margin-bottom: 0.3em; } +.markdown-alert-note, .note { border-left: 0.2em solid #31a0fc; background: #31a1fc1f; } +.markdown-alert-tip, .tip { border-left: 0.2em solid #25cb1c; background: #31fc491f; } +.markdown-alert-important, .important { border-left: 0.2em solid #911ccb; background: #bc31fc1f; } +.markdown-alert-warning, .warning { border-left: 0.2em solid #e0b840; background: #efc7461f; } +.markdown-alert-caution, .caution { border-left: 0.2em solid #e04040; background: #ef5f461f; } +/* markdown-it-alert-title. We *should* use their provided styles really.... but meh */ +.markdown-alert-title { display: none; } .contributor-list { list-style-type: none; diff --git a/.docs/lib/parse_sections.js b/.docs/lib/parse_sections.js index 8f8be3b..6fddd2e 100644 --- a/.docs/lib/parse_sections.js +++ b/.docs/lib/parse_sections.js @@ -21,6 +21,9 @@ markdown.use(markdown_prism, { } }); +const alerts = require("markdown-it-github-alerts"); +markdown.use(alerts); + function extract_title(line) { return line.match(/#+\s+(.+)\s*/)[1].replace(/^`*|`*$/g, "") } diff --git a/.docs/package-lock.json b/.docs/package-lock.json index 94d2e16..d9e5743 100644 --- a/.docs/package-lock.json +++ b/.docs/package-lock.json @@ -1,12 +1,12 @@ { "name": "worldeditadditions", - "version": "1.0.0", + "version": "1.14.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "worldeditadditions", - "version": "1.0.0", + "version": "1.14.5", "license": "MPL-2.0", "dependencies": { "@11ty/eleventy": "^2.0.1", @@ -17,6 +17,7 @@ "html-entities": "^2.4.0", "html-minifier-terser": "^7.0.0-beta.0", "imagickal": "^5.0.1", + "markdown-it-github-alerts": "^0.1.2", "markdown-it-prism": "^2.3.0", "p-memoize": "^7.1.1", "p-queue": "^7.3.4", @@ -1515,6 +1516,17 @@ "markdown-it": "bin/markdown-it.js" } }, + "node_modules/markdown-it-github-alerts": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/markdown-it-github-alerts/-/markdown-it-github-alerts-0.1.2.tgz", + "integrity": "sha512-jtCrfFxXR6c/bNRBvWkoqUquEDdIF9q7/gNZjP47W96kaIiBMiYHbpf468IPeZJB5BVRls6+IXGchhQSTxy0DQ==", + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "markdown-it": "^13.0.0" + } + }, "node_modules/markdown-it-prism": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/markdown-it-prism/-/markdown-it-prism-2.3.0.tgz", @@ -3645,6 +3657,12 @@ } } }, + "markdown-it-github-alerts": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/markdown-it-github-alerts/-/markdown-it-github-alerts-0.1.2.tgz", + "integrity": "sha512-jtCrfFxXR6c/bNRBvWkoqUquEDdIF9q7/gNZjP47W96kaIiBMiYHbpf468IPeZJB5BVRls6+IXGchhQSTxy0DQ==", + "requires": {} + }, "markdown-it-prism": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/markdown-it-prism/-/markdown-it-prism-2.3.0.tgz", diff --git a/.docs/package.json b/.docs/package.json index 48c7649..386411c 100644 --- a/.docs/package.json +++ b/.docs/package.json @@ -28,6 +28,7 @@ "html-entities": "^2.4.0", "html-minifier-terser": "^7.0.0-beta.0", "imagickal": "^5.0.1", + "markdown-it-github-alerts": "^0.1.2", "markdown-it-prism": "^2.3.0", "p-memoize": "^7.1.1", "p-queue": "^7.3.4",