holy this shit is so long
heyo! this is a long one, so i’ll go over this commit by commit
-
(0ad2cb2) Start paragraph parsing
here, i did these:
- i made a global string
stateto maintain the nesting while styling. managing this was quite tedious and useless - i added a helper function to get the style of a token called
getStyle(). i’ll explain the use for it below. - i continued working on the
heading()andparagraph()functions as well as thestylize()function
- i made a global string
-
(eb218d2) Add markdown extensions
as for this one, i added a bunch of packages, mostly extensions formarkdown-it. these are:markdown-it-footnotemarkdown-it-github-alertsmarkdown-it-sanitizermarkdown-it-tablemarkdown-it-task-lists-
shiki(for code highlighting) -
terminal-image
i removed a few of these later because they were either not really working properly or just weren’t necessary.
besides these, i also configured the plugin to use the plugins, enable the autolink extension and also replace all HTML line breaks (
<br>) with double newlines (\n\n) -
(5ecef2c) Start working on image rendering and colors/styles
now here is where i found a gem in my dependency tree. you see, i was searching for a package to handle color rendering since i sure as hell wasn’t gonna deal with the hex codes
shiki, the code-highlighting plugin, was giving me for the colors of the tokens. so i saw a package calledchalkand it sounded familiar. turns out,shikihadchalkas a dependency, so it was already installed!for that reason, i added a chalk import in this commit. i also started working on an image function to render images, and named it
renderImage(). also added a great error message if two requirements weren’t met:throw new Error("WRONG TOKEN IDIOT DEV");but that was all i really did in that function
-
(0dc393d) Remove unnecessary object processing and dependencies
this is where i removed
markdown-it-footnoteandmarkdown-it-tablebecause i realized there just wasn’t a point in those since they weren’t letting me test my function, they were erroring out for some reason and i found outmarkdown-it-tablealready had support for markdown tables. i also removed the mapping function in the parser stage that i made to give myself only a few fields. it was pretty useless since i kept randomly finding that i’d need some new property. -
(8a5200c) Continue work on inline parsing, add
terminal-linklatest commit, this is where i did a lot of work:
- i removed
terminal-imageas a dependency since i found that bun already provided a class for it (Bun.Image) and it also had webp support unliketerminal-image, so no point in another package when a built-in one works better
- i made the
getStyles()function better - i added a bunch of micro-functions like
bold(),italic(), etc. i also renamedrenderImage()toimage() - i combined two if statements into one in this
image()function because why 2 if statements when 1 - i did a lot of work in the
renderInline()function. now it uses computed function names that call those micro-functions. - i also changed that global string
stateto a global array, made things much easier. - i worked on the
heading()andparagraph()functions further
- i removed
that’s about it gng, also its 12:28 am for me rn
this is why we devlog more often gng ✌️
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.