....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!
This commit is contained in:
Starbeamrainbowlabs 2023-12-20 00:40:35 +00:00
parent 8a143e9a4b
commit d07c1709cf
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 50 additions and 4 deletions

View file

@ -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;

View file

@ -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, "")
}

View file

@ -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",

View file

@ -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",