Racket-CommonMark Improvements

Written by Dominik Pantůček on 2024-10-24

racketpunctmarkdownweb

As we have already revealed, we use Punct to produce our new website. Punct is extending CommonMark with metadata and uses Racket racket-commonmark. Sometimes there are problems with software, but usually those can be solved - as happened in this case. And with a new release, new features arrived as well.


The issue we ran into was #5, already reported by Bogdan Popa in February. Trouble was, he did not fix that - which should have raised an alert that this is not going to be an easy issue to fix. It looked almost trivial. Whenever there was a nested list followed by a paragraph, the list attributes are incorrect which in turn produces unwanted HTML output for us. An example would be:

- Top level 1
- Top level 2
  - Nested A
  - Nested B

Some text here...

This should render as this:

  • Top level 1
  • Top level 2
    • Nested A
    • Nested B

Some text here...

But it rendered as follows:

  • Top level 1
  • Top level 2
    • Nested A

    • Nested B

Some text here...

The nested list got marked as 'loose instead of 'tight. That cannot be hard to fix, right? It turned out it was very hard and even then although the solution worked, it did definitely not look nice. Our attempt at simple fix is archived for future generations as PR#7.

But luckily, Alexis King jumped in and fixed the issue properly, releasing a bugfix version. The CHANGELOG says:

1.1.1 (2024-10-07)

  • Fixed bug that caused inline links to sometimes fail to parse. (#4, f96082a)
  • Fixed nested list tightness sometimes being incorrect. (#5, e0b9dec)

This alone would be more than enough, however that was not the end. Now we can enjoy a new minor version which includes support for latest CommonMark spec as can be (again) seen from the change list:

1.2 (2024-10-07)

  • Updated from CommonMark v0.30 to v0.31.2. (f28bafb)

    The behavioral changes are quite minimal. The relevant bullets from the CommonMark changelog are:

    • Add symbols to unicode punctuation (Titus Wormer).
    • Add search element to list of known block elements (Titus Wormer).
    • Remove source element as HTML block start condition (Lukas Spieß).
    • Remove restrictive limitation on inline comments; now we match the HTML spec (Titus Wormer).

What else can be said except for a big thanks to Alexis and that really it is pleasure to work with Racket community backing the whole ecosystem.

Enjoy the autumn and see ya next time!