when the FUCK did this become 4 hours 
so uhh i spent like all of this time debugging and improving my code.
first thing is, i replaced these “microfunctions”, as i call them, with
an object that had keys whose values were arrow functions. these arrow
functions did the exact same thing and took up less space and was even
more readable!
second, i spent some time on a stupid bug where the main function in
stylize.js would hang. i thought it was an issue with the image
function, but after half an hour or so, when i added console.log(done)
right before the return, i realized it had to do with the main function
that was calling the image function, and sure enough, the second i
looked at it, i realized the problem: it was a while loop and i forgot
to add a line that incremented the index, so it just kept doing the
same thing forever until i killed the process
oh well, more hours for me 
third, i improved (or rather cleaned) my image function. it returns
promises and doesn’t use terminal-image directly. instead, i made it
so that it would return an object with a bunch of keys, one of which is a
function that takes the whole object as an input. this function
actually renders the image, since i plan to write the function to
display it in a way that deals with image rendering after rendering
text, and while the images get rendered, a spinner takes their place
temporarily, but the images replace those spinners once they are
processed
fourth thing is, i made it so that the main function calls the
renderInline function instead of the paragraph function. in fact,
this paragraph function is completely useless, so i went ahead and
removed it too.
lastly, i upgraded a bunch of packages:
- upgraded
typescriptfrom version 5 to 5.9.3 - upgraded
gotfrom version 15.0.7 to 15.1.0 - upgraded
markdown-itfrom version 14.2.0 to 14.3.0 - upgraded
shikifrom version 4.3.0 to 4.3.1
if you wonder what these packages are
-
typescriptis, well, the typescript language, not sure why i have
it, might be a dependency for another package. -
gotis some package that does pretty much the same thing as the
defaultfetch()but it can give me a buffer, which i need for images -
markdown-itis the markdown parser -
shikiis for coloring code. fancy, right?
Changelog
aight this took me 2 hours to write and i started coding again in the
middle of writing this 
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.