From 899a56ffc3c9cc1bd56d6bd977b4c61622fb79ce Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Sun, 14 Sep 2025 10:55:17 +0200 Subject: [PATCH] Markdown Fix --- src/elements/BigFont.lua | 5 +++-- tools/BasaltDoc/utils/markdownGenerator.lua | 22 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/elements/BigFont.lua b/src/elements/BigFont.lua index 7847738..7fa9e07 100644 --- a/src/elements/BigFont.lua +++ b/src/elements/BigFont.lua @@ -1,4 +1,3 @@ ----@splitClass ------------------------------------------------------------------------------------- -- Wojbies API 5.0 - Bigfont - functions to write bigger font using drawing sybols -- ------------------------------------------------------------------------------------- @@ -11,8 +10,10 @@ -- 5. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. -- NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT DESIGNED, LICENSED OR INTENDED FOR USE IN THE DESIGN, CONSTRUCTION, OPERATION OR MAINTENANCE OF ANY NUCLEAR FACILITY. + -- Basalt - Nyorie: Please don't copy paste this code to your projects, this code is slightly changed (to fit the way basalt draws elements), if you want the original code, checkout this: -- http://www.computercraft.info/forums2/index.php?/topic/25367-bigfont-api-write-bigger-letters-v10/ +---@skip ---@class BigFontText local tHex = require("libraries/colorHex") @@ -137,7 +138,7 @@ local function makeText(nSize, sString, nFC, nBC, bBlit) return {tText, tFront, tBack} end ---- This part has nothing to do with Wojbie's BigFont API: +-- This part has nothing to do with Wojbie's BigFont API: local elementManager = require("elementManager") local VisualElement = elementManager.getElement("VisualElement") diff --git a/tools/BasaltDoc/utils/markdownGenerator.lua b/tools/BasaltDoc/utils/markdownGenerator.lua index 67088fd..8d4ee79 100644 --- a/tools/BasaltDoc/utils/markdownGenerator.lua +++ b/tools/BasaltDoc/utils/markdownGenerator.lua @@ -1,5 +1,22 @@ local markdownGenerator = {} +local function processDescription(description) + if not description then return nil end + local lines = {} + for line in description:gmatch("([^\n]*)\n?") do + if line ~= "" then + -- URLs in Markdown-Links umwandeln + line = line:gsub("https?://[^%s]+", function(url) + return "[" .. url .. "](" .. url .. ")" + end) + table.insert(lines, "_" .. line .. "_") + else + table.insert(lines, "") + end + end + return table.concat(lines, "\n") +end + local function generateFunctionMarkdown(class, functions) local md = {} @@ -130,7 +147,10 @@ function markdownGenerator.generate(ast) local title = class.title or class.name table.insert(md, "# " .. title) if class.description then - table.insert(md, "_" .. class.description .. "_") + local processedDesc = processDescription(class.description) + if processedDesc then + table.insert(md, processedDesc) + end end if class.extends then table.insert(md, "")