Write a markdown - curses converter The NetBSD Project
Status: Closed Time to complete: 192 hrs Mentors: Julian Coleman, Julian Fagir Tags: C, Curses, research, wiki, ui

This task is not strictly for NetBSD, but another project named libsoldout: http://fossil.instinctive.eu/libsoldout/index

libsoldout is a markdown converter written in C and published under public domain. Though there are already other tools which would do this task, they either have a licence that is not usable by NetBSD or have too many dependencies (like pandoc).

As we maybe want to use libsoldout for shell usage, and mdoc is too slow to be parsed, we want a converter which directly translates markdown directly to something terminal-readable, i.e. either bold or underlined text and indentation. The overall look should look like mdoc.

Markdown itself is already plaintext-readable, but there are some things which could be more nice. Additionally, we have to parse it anyway to use links. All in all, it's mainly about specifying some tags you use for inserting and putting it in C code.

You can take the html or the mdoc converter as a template for this:
http://fossil.instinctive.eu/libsoldout/artifact/fd100c723c722189d62fd9bf261d67db69240043 and http://fossil.instinctive.eu/libsoldout/artifact/1e22b7962dfba92c28f4916609746045dbe29a90 respectively.

Though this task seems large, the task itself is rather small. You have to analyze the converters for mdoc and html and replace their tags by the appropriate curses ones.

If you've never worked with curses, feel free to ask. You won't need many tags, only the formatting things like bold font, coloured font. Knowing curses is not a prerequisite.


You don't have to fully cover markdown. Some tags (links and images at least) cannot be displayed, but you should provide hooks for everything and leaving those, which cannot be used, empty.

Uploaded Work
File name/URL File size Date submitted
https://github.com/zielmicha/markdown-to-t... n/a December 05 2012 18:07 UTC
Michał Zieliński on December 4 2012 16:24 UTC Task Claimed

I would like to work on this task.

Radoslaw Kujawa on December 4 2012 16:38 UTC Task Assigned

This task has been assigned to Michał Zieliński. You have 192 hours to complete this task, good luck!

Michał Zieliński on December 4 2012 16:43 UTC terminfo or only vt100

Do I have to use terminfo/curses or may I use standard vt100/xterm codes?

Julian Fagir on December 4 2012 18:01 UTC terminfo/curses only please

Please use only curses or terminfo, something generic. You should use the smallest, but sufficient library available (I think this will be terminfo).

vt100/xterm is very specific and there are several situations where you don't have them, let it be rxvt, tmux, screen or simply just a shell.

Michał Zieliński on December 4 2012 18:04 UTC Ok

Ok, I will use terminfo.

Just to note: vt100/xterm is mostly compatible with rxvt, screen and Linux console (I don't know about BSD's).

Aleksej Saushev on December 4 2012 18:25 UTC Clarification: NetBSD

Please, note that your program should work on NetBSD.

Michał Zieliński on December 5 2012 18:10 UTC Empty hooks

I didn't take "Some tags (links and images at least) cannot be displayed, but you should provide hooks for everything and leaving those, which cannot be used, empty" literally.

In examples NULL is provided for unused hooks and I don't see the point of creating empty functions.

(as of commit 2cb199a16d1c4882c1e730035a4c8f1d7ff24431)

Michał Zieliński on December 5 2012 18:28 UTC Ready for review

The work on this task is ready to be reviewed.

Julian Fagir on December 6 2012 00:44 UTC Fine

Thank you for your work, the result is fine.

There are some things I would change about the formatting (e.g. indentation), but these are rather my personal preferences than something I would require for a task. 

Julian Fagir on December 6 2012 00:44 UTC Task Closed

Congratulations, this task has been completed successfully.