💾 Archived View for not-a-web-developer.srht.site › 2022 › April › lua.gmi captured on 2022-06-11 at 21:22:57. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Lua is complicated

But I'm fine with it.

so it's context time!

You know lite-xl? (If you don't, go read the post I wrote on it)

my original post about lite-xl

So there's this plugin for lite-xl called ghmarkdown (shorthand for GitHub markdown) which allowed for preview of markdown files by sending them to GitHub's markdown rendering API.

the ghmarkdown plugin.

as you can expect, this isn't a good look for a FOSS program.

The loss of trust by sending data to a closed source organization isn't worth the convenience of rendering markdown, is it?

That said however, i do wanna render my markdown files.

So I decided to write my own markdown rendering plugin for lite-xl.

Now if you know anything about me, you know i have a bit of a problem trying to read languages that use a lot of symbols, like brackets and arrows and whatnot.

Lua certainly has an element of that.

anyway, so if I don't use GitHub markdown API, what do I use instead?

I have the following options:

Oh and it's not even the end of problems for pandoc: WHY IS IT SO LARGE? I realise it supports a very large number of formats for conversion, however they should provide a "lite" version for the common conversions; i don't know why they don't.

After all these, I found luamd.

Luamd is a simple markdown rendering library just like markdown.lua, however it's not nearly as stale as markdown.lua and supports most of GitHub Flavoured Markdown!

unfortunately, life isn't smooth sailing here either.

There's a file i have, called test.md which has every feature used in commonmark and GitHub Flavoured Markdown. However, luamd doesn't like that file for some reason, and simply doesn't convert it.

because of this, I'm thinking of using pandoc for conversion to html.

I know pandoc is large and the executable issue exists, so for now I'm making it mandatory to have a global install of pandoc; not to mention I'm keeping the pandoc version on a separate branch.

all this still doesn't sound like the topic of this post.

You're right! This was simply the context.

so what do i wanna talk about?

learning Lua for this small project taught me how programming works.

at this point you must be throwing your arms in the air going

whaaaat? you didn't know how to program?

well, yes and no.

of course i know how to write hello world, and how to do the "enter a number, enter another number, here's some random math done with them" kinds of programs.

that said however, i didn't know how to write programs that actually matter. like the kind of things you actually do programming for. making useful applications. a text editor, or a mail client or something.

As it turns out, there is an almost insurmountable gap between the two.

one can only leap to the other side if they have the kind of logic required to write computer programs.

you, dear reader, are one of two types of people; you either have the programming logic deeply ingrained inside your mind, or you don't have it in you at all.

Either way, you probably have no idea what i'm talking about.

have you ever seen people on forums, talking about how they looked through tutorials and courses and made stuff, but when they have to make something on their own, they're completely blank?

that's what i mean.

Having knowledge of syntax means nothing if you have no idea how to solve problems. Programming, at its core, is you trying to make a computer do what you want; if you have no meaningful answer for the computer when it asks you what you want it to do, you have failed as a programmer.

FINALLY, AN ORIGINAL QUOTE

Anyway, i hope you get my point.

tl;dr: writing a plugin opened my third eye, and now i'm the god of programming

this post was written on April 14, 2022.

go back to home