You are browsing as a guest. Sign up (or log in) to start making projects!

6h 13m 27s logged

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 state to 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() and paragraph() functions as well as the stylize() function
  • (eb218d2) Add markdown extensions
    as for this one, i added a bunch of packages, mostly extensions for markdown-it. these are:

    • markdown-it-footnote
    • markdown-it-github-alerts
    • markdown-it-sanitizer
    • markdown-it-table
    • markdown-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 called chalk and it sounded familiar. turns out, shiki had chalk as 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-footnote and markdown-it-table because 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 out markdown-it-table already 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-link

    latest commit, this is where i did a lot of work:

    • i removed terminal-image as a dependency since i found that bun already provided a class for it (Bun.Image) and it also had webp support unlike terminal-image, so no point in another package when a built-in one works better :wiltedrose:
    • i made the getStyles() function better
    • i added a bunch of micro-functions like bold(), italic(), etc. i also renamed renderImage() to image()
    • 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 state to a global array, made things much easier.
    • i worked on the heading() and paragraph() functions further

that’s about it gng, also its 12:28 am for me rn :fear: :1000-yard-stare: this is why we devlog more often gng ✌️

0
11

Comments 0

No comments yet. Be the first!