git.iko.soy/typeable/servant
on master help sign in
Make sure code blocks are indented in markdown documentation

This relies on the behaviour of pandoc, and as such may not apply to other Markdown renderers. Before this change, you would have something like: > - Example: `application/json` > > ```javascript > "HELLO, HASKELLER" > ``` When converting this to HTML, PDF, etc. the code block is _not_ contained within the bullet point. With this change, the generated markdown looks like: > - Example: `application/json` > > ```javascript > "HELLO, HASKELLER" > ``` With pandoc at least, this effectively indents the entire code block to be under the bullet point, which is the intended effect. Note that the code itself is _not_ indented (which might break other Markdown renderers) as to do so would require splitting on newlines, which may have unintended consequences when dealing with generated values (may contain `\r\n`, etc.).

commit4f8df0ebe205a90139c4901ac7a7cee613564ebf authorIvan Lazar Miljenovic <Ivan.Miljenovic@gmail.com> dateThu 5 Oct 2017, 14:41 (9 years ago) parent061bf7a
1 file changed+3−2
servant-docs/src/Servant/Docs/Internal.hs+3−2
servant-docs/src/Servant/Docs/Internal.hs+3−2
@@ -653,11 +653,12 @@ markdown api = unlines $
653653 ("text", "css") -> "css"
654654 (_, _) -> ""
655655
656+
656657 contentStr mime_type body =
657658 "" :
658− "```" <> markdownForType mime_type :
659+ " ```" <> markdownForType mime_type :
659660 cs body :
660− "```" :
661+ " ```" :
661662 "" :
662663 []
663664