Qt Hackathon December 2017: adding Markdown support in QTextDocument
Channel: ecloud
Date: 2019-09-23

This was a video I made for my colleagues to explain what I accomplished during a 2-day hackathon, which is something we do at the Qt Company once or twice a year, to give developers like me a chance to do stuff that we otherwise might not get around to during normal business hours.

The result was https://codereview.qt-project.org/#/c/214843/ and (quite) a few more patches on top.  It took a few more weeks of my spare time to polish it up, add full support for checklists in both QTextEdit and Qt Quick TextEdit, create the markdown writer class, and get the Markdown support working well enough overall that I can use a Qt-based Markdown editor without running into show-stopper problems right away; and even longer to find a colleague who was willing to review the patches.  So a year and a half later, we finally got all the patches integrated into dev branch, and now we are ready to ship these features in Qt 5.14.

The TextEdit example that ships with Qt makes a decent editor, but it's missing a few features, such that you can't interactively create all the formatting that it's able to show.  Nettebook ( nettebook.org / https://github.com/ec1oud/nettebook/ ) is another project of mine where I am creating a more full-featured editor that I actually use for note-taking and probably eventually for todo lists and blog posts. (I rather like https://f-droid.org/en/packages/nl.mpcjanssen.simpletask/ and todo.txt format, but it doesn't support mixing notes and tasks; thus markdown is better, in theory.)

Thanks to Martin Mitáš of the https://github.com/mity/md4c project for being so quick to add new features to MD4C (including all the github features, including tables and task lists) and for taking such a rigorous approach to implementing the CommonMark standard.  I probably would not have taken on this project if I had to write a Markdown parser from scratch.