Compare commits

...

7 Commits

Author SHA1 Message Date
Starbeamrainbowlabs 71d95b5e83
reference: add some more alerts in key places 2023-12-20 00:44:39 +00:00
Starbeamrainbowlabs d07c1709cf
....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!
2023-12-20 00:40:35 +00:00
Starbeamrainbowlabs 8a143e9a4b
docs: add theme for note/tip/important/warning/caution alerts
Ref https://github.com/orgs/community/discussions/16925
.....unfortunately markdown-it (our markdown renderer) doesn't support the GitHub syntax yet
2023-12-20 00:29:10 +00:00
Starbeamrainbowlabs 37821f11d5
docs/img2brush: limit height of output, update wording 2023-12-20 00:07:24 +00:00
Starbeamrainbowlabs 2722a190f4
reference: update do cs about img2brush tool 2023-12-19 23:47:20 +00:00
Starbeamrainbowlabs 8ee7470435
docs: fix incorrect header handling in markdown rendering 2023-12-19 23:41:37 +00:00
Starbeamrainbowlabs edbb6db264
//rotate: zero out param2 of source
Actually copying over and hanlding param2 properly ref rotation will require //orient+ first
2023-12-19 23:37:15 +00:00
7 changed files with 87 additions and 11 deletions

View File

@ -442,6 +442,47 @@ footer {
border: 0.2em solid var(--cat-colour);
}
.note, .tip, .important, .warning, .caution,
.markdown-alert {
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"; }
.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;
@ -486,3 +527,8 @@ footer {
animation: move-diagonal 5s linear infinite;
}
#brushimg-preview { flex: 1; }
#brushimg-tsv {
display: block;
max-height: 90vh;
overflow: scroll;
}

View File

@ -17,6 +17,7 @@ title: Image to brush converter
</select>
</p>
<p>Only the selected channel is used to determine the weight of the brush - <strong>all other channels are ignored</strong>! Change the channel option <strong>before</strong> you drag + drop the image onto this page.</p>
<p class="note">Greyscale images are converted to RGB, so <em>red</em>, <em>green</em>, and <em>blue</em> all have the same effect on such images.</p>
</section>
<section id="dropzone" class="bigbox panel-generic">

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, "")
}
@ -39,8 +42,8 @@ function make_section(acc, cat_current, cats) {
.replace(/\s+/g, "-")
.replace(/-.*$/, ""),
content: markdown.render(acc.slice(1).join("\n"))
.replace(/<h4(\/?)>/g, "<h3$1>")
.replace(/<h5(\/?)>/g, "<h4$1>")
.replace(/<(\/?)h4>/g, "<$1h3>")
.replace(/<(\/?)h5>/g, "<$1h4>")
};
}

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

View File

@ -381,7 +381,8 @@ Scale Factor | Meaning
In short, you can specify the scale factor directly, as a percentage, or as 1 number divided by another number.
**Note:** `//scale` always scales in the _positive direction_ by default. This can be changed however - see below.
> [!NOTE]
> `//scale` always scales in the _positive direction_ by default. This can be changed however - see below.
With this in mind, there are 3 forms that you can tell `//scale` how you want to scale the defined region:
@ -838,7 +839,7 @@ To assist with the creation of static brushes, a tool exists to convert any imag
<https://worldeditadditions.mooncarrot.space/img2brush/>
The tool operates on the **alpha channel only**, so it's recommended to use an image format that supports transparency. All colours in the R, G, and B channels are ignored.
The tool can operate on the colour channel of your choice - red, green, blue, or alpha.
If you've created a cool new brush (be it static or dynamic), **please contribute it to WorldEditAdditions**! That way, everyone can enjoy using your awesome brush. [WorldPainter](https://www.worldpainter.net/) has many brushes available in the community, but `//sculpt` for WorldEditAdditions is new so don't have the same sized collection yet :-)
@ -948,7 +949,8 @@ Since WorldEditAdditions v1.13, a list of node names is also optionally supporte
### `//count`
Counts all the nodes in the defined region and returns the result along with calculated percentages (note that if the chat window used a monospace font, the returned result would be a perfect table. If someone has a ~~hack~~ solution to make the columns line up neatly, please [open an issue](https://github.com/sbrl/Minetest-WorldEditAdditions/issues/new) :D)
**Note:** The output of `//count` can be rather long sometimes, and Minetest by default only shows the last few lines of chat. Press <kbd>F10</kbd> to show the full chat window that you can then scroll through to inspect the full output.
> [!NOTE]
> The output of `//count` can be rather long sometimes, and Minetest by default only shows the last few lines of chat. Press <kbd>F10</kbd> to show the full chat window that you can then scroll through to inspect the full output.
```weacmd
//count
@ -1321,7 +1323,8 @@ Note also that `<cmd_name>` should _not_ be prefixed with _any_ forward slashes
While other server commands can be executed while a `//subdivide` is running, `//subdivide` manipulates your player's defined region when running. This has the side-effect that you can check on where it has got up to with `//p get` for example - but means that attempting to change your pos1 & pos2 manually will have no effect until the `//subdivide` completes.
**Warning:** Once started, this command cannot be stopped without restarting your server! This is the case with all WorldEdit commands, but it's worth a special mention here.
> [!WARNING]
> Once started, this command cannot be stopped without restarting your server! This is the case with all WorldEdit commands, but it's worth a special mention here.
```weacmd
//subdivide 10 10 10 set dirt

View File

@ -45,9 +45,10 @@ function worldeditadditions.rotate(pos1, pos2, origin, rotlist)
--- 3: Check out a VoxelManipulator for the source and target regions
-- TODO support param2 here
-- TODO support param2 here. We zero out the source.... but don't carry over to the target. This probably requires //orient+ first.
local manip_src, area_src = worldedit.manip_helpers.init(pos1, pos2)
local data_src = manip_src:get_data()
local param2_src = manip_src:get_param2_data()
-- TODO: grab only an area at this point for dest and a blank target table. Then copy over to the real dest later to ensure consistency. This is important because we are dealing in (potentially) non-cardinal rectangles here
-- local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
@ -88,12 +89,15 @@ function worldeditadditions.rotate(pos1, pos2, origin, rotlist)
for z = pos2.z, pos1.z, -1 do
for y = pos2.y, pos1.y, -1 do
for x = pos2.x, pos1.x, -1 do
data_src[area_src:index(x, y, z)] = id_air
local src_i = area_src:index(x, y, z)
data_src[src_i] = id_air
param2_src[src_i] = 0
end
end
end
manip_src:set_param2_data(param2_src)
worldedit.manip_helpers.finish(manip_src, data_src)
manip_src, area_src, data_src = nil, nil, nil
manip_src, area_src, data_src, param2_src = nil, nil, nil, nil
--- 6: Reinitialise the destination VoxelManip and copy data over