Literate Markdown

Trevor Elliott trevor at
Thu Jun 20 01:28:27 CEST 2013

Hi All,

I've implemented support for literate markdown in a branch [1].  After 
doing a search on the bug tracker to see if anyone had already worked on 
this I came across bug #4836 [2], which details some unexpected 
interactions between the markdown format, unlit and CPP.  Specifically, 
unlit attempts to keep CPP in the comment sections of a literate file, 
which clashes with the way that headings are defined in markdown.

The approach that I took is that when GHC is processing markdown files, 
it passes the -r and -# flags to unlit, causing it to remove CPP in the 
comment parts of the file.  I've added support for .markdown and .md as 
source file extensions supported by GHC to be able to detect when this 
is necessary.  CPP can still be used within code blocks, giving a path 
forward for the case where the file was generated by something that 
wishes to leave #line markers.  I've documented the changes on the wiki 
at [3].

Does this approach sound reasonable?  If so, should I attach a patch to 
#4836, or create a new ticket?




-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2311 bytes
Desc: S/MIME Cryptographic Signature
URL: <>

More information about the ghc-devs mailing list