docs: add Lua API to site via moondoc!

Ref https://github.com/sbrl/moondoc
This commit is contained in:
Starbeamrainbowlabs 2024-01-02 16:31:30 +00:00
parent 1ca524bbc3
commit 15a52deea1
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2
7 changed files with 1395 additions and 153 deletions

@ -10,6 +10,7 @@ const phin = require("phin");
const CleanCSS = require("clean-css");
const { minify: minify_html } = require("html-minifier-terser");
const moondoc_runner = require("./lib/moondoc_runner.js");
const HTMLPicture = require("./lib/HTMLPicture.js");
const FileFetcher = require("./lib/FileFetcher.js");
@ -120,6 +121,10 @@ async function do_minify_html(source, output_path) {
if(is_production) console.log("Production environment detected, minifying content");
module.exports = function(eleventyConfig) {
moondoc_runner(
path.resolve(__dirname, "_site/api/index.html")
);
eleventyConfig.addTransform("cssmin", do_minify_css);
eleventyConfig.addTransform("htmlmin", do_minify_html);
@ -140,4 +145,5 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy({
"node_modules/keen-slider/keen-slider.es.js": "./keen-slider.es.js"
});
}

@ -1,11 +1,12 @@
<main>
<section class="panel-generic">
<h1 id="#reference">Reference</h1>
<p>This is the full chat command reference for WorldEditAdditions. It has 2 parts:</p>
<p>This is the full chat command reference for WorldEditAdditions. It has 3 parts:</p>
<ol>
<li>A contents list of commands and their syntax</li>
<li>A full reference, with detailed explanations for each command</li>
<li>The <a href="/api/">Lua API</a>, which may be useful for mod authors or those wishing to hack on the WorldEditAdditions codebase.</li>
</ol>
<p>There is also a <a href="#filter">filter box</a> for filtering everything to quickly find the one you're after.</p>

@ -262,7 +262,8 @@ footer {
margin: 3em 0 0 0;
padding: 1em;
text-align: center;
background: var(--pattern-jigsaw-green),
background: linear-gradient(to left, #fff2, #fff2),
var(--pattern-jigsaw-green),
var(--bg-bright);
/* color: var(--text-bright); */
}

@ -0,0 +1,22 @@
"use strict";
const promisify = require("util").promisify;
const fs = require("fs");
const path = require("path");
const child_process = require("child_process");
const filepath_moondoc = path.resolve(__dirname, `../node_modules/.bin/moondoc`);
const dirpath_root = path.resolve(__dirname, `../..`);
module.exports = function moondoc_runner(filepath_output) {
const dirpath = path.dirname(filepath_output);
if(!fs.existsSync(dirpath)) {
fs.mkdirSync(dirpath, { recursive: true });
}
child_process.execFileSync(filepath_moondoc, [
"build",
"--input", dirpath_root,
"--output", filepath_output
]);
}

1499
.docs/package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -29,8 +29,9 @@
"html-minifier-terser": "^7.0.0-beta.0",
"imagickal": "^5.0.1",
"keen-slider": "^6.8.6",
"markdown-it-github-alerts": "^0.1.2",
"markdown-it-github-alerts": "^0.2.0",
"markdown-it-prism": "^2.3.0",
"moondoc": "^1.0.1",
"p-memoize": "^7.1.1",
"p-queue": "^7.3.4",
"phin": "^3.7.0",

@ -1,7 +1,15 @@
--- WorldEditAdditions
--- WorldEditAdditions Lua API
--
-- This is the documentation for the Lua API of WorldEditAdditions. It was generated automatically from comments spread across the codebase with [moondoc](https://github.com/sbrl/moondoc).
--
-- **Current version:** 1.15-dev
--
-- These docs are a work-in-progress. **Not all functions are documented here yet.** If anything is unclear, please [open an issue](https://github.com/sbrl/Minetest-WorldEditAdditions/issues/new).
--
-- © 2023 Starbeamrainbowlabs and contributors. Licenced under the Mozilla Public License 2.0.
-- @namespace worldeditadditions
-- @release 1.14.5
-- @copyright 2023 Starbeamrainbowlabs
-- @copyright 2023 Starbeamrainbowlabs and contributors
-- @license Mozilla Public License, 2.0
-- @author Starbeamrainbowlabs