1. 9

We’re starting a new series of Developer Challenges to present interesting problems we’ve worked with as self-contained challenges.

Each challenge will contain a detailed solution, illustrated. This round’s solution is written in Ruby, but solutions from any language are welcome. Other rounds examples may span into Javascript, Python, Java, Scala, Kotlin, or any other number of languages depending on the author.

Give it a shot! Looking forward to seeing some interesting solutions.

  1.  

  2. 5

    I did this in Python recently, maybe someone will find it interesting:

    https://git.sr.ht/~sircmpwn/srht/tree/srht/markdown.py#n55

    1. 3

      I’m using such a script (Perl – yay) for my blog: https://gir.st/genindex (not really a url I’m considering stable)

      Despite the popularity of markdown and static page generators, I’m writing my posts in plain HTML, and a heading usually looks like <hX id=foo>. then I’m calling above script from within vim to generate the toc.

      Looking forward to the next challenges!

      1. 2

        One I did in JS to try to learn node as an environment. I basically hook into the brains of marked.js and create a TOC from its internal representation.

        1. 1

          The article is nice, but I really need to address something different here: Isn’t anybody else bothered by the medium-header taking up like 10% of screen space permanently, even when scrolled down in the article? Who thought this was a good idea?