Following on from the discussion at #266 and a Reddit thread, I'd like to try getting literate Haskell rendering back into GitHub in an opt-in fashion. The goal is to only render .lhs
files as markdown (via the literati
library) _if_ they contain a specific HTML comment (<!-- literate-haskell: markdown -->
). I figured on doing something like this:
markup(:literati, /lhs/) do |content|
if content =~ /^<!--\s*literate-haskell:\s*markdown\s*-->/
Literati.render(content)
else
content
end
end
However, how will this interact with GitHub's content rendering? The goal is to have files completely unrendered if they do not contain the formatted comment.
Currently a renderer is chosen based purely on filename, and if GitHub::Markup
says it can render the file, then GitHub expects that rendered HTML will be returned. So any support for .lhs
would have to always render something. We would be happy to consider a pull request for this, but I'll warn you that adding new markup formats is not currently a high priority.
Okay, thanks!
How about .md.lhs
, .rst.lhs
, etc, for example?
Would an extension like A.md.lhs
confuse GHC? Would it still find the file? What would be the module name?
Most helpful comment
How about
.md.lhs
,.rst.lhs
, etc, for example?